Hi André,
On Fri, Dec 03, 2010 at 10:18:28PM +0100, André Wobst wrote:
> The solution Axel proposed in this thread is the way to go. However,
> you may just copy the whole arrow style and remove all arrow stuff
> from it keeping the lines only.
> 
> While I think we should not allow for size=None in the arrow
> decorator, I don't see any particular problem to allow arrowsize=0 in
> the graph.arrow style for a very simple solution to your problem. I
> submitted a patch in changeset 3034, so in case you use the SVN
> version of PyX, just update, set arrowsize to None and you're done.

Yesterday evening, I was also wondering about another possible solution:
I would propose to add the possibility to pass an arbitrary decorator to
plot-style's constructor.  In the actual style, I don't see a
possibility to:
 - reverse the direction of the arrow
 - change the position where the arrowhead is added
 - change the constriction of the arrowhead
 - change the opening-angle of the arrowhead

However, by adding an additional parameter to the constructor of
"graph.style.arrow"

def __init__(self, linelength=0.25*unit.v_cm, arrowsize=0.15*unit.v_cm, 
lineattrs=[], arrowattrs=[], arrowpos=0.5, epsilon=1e-5, decorator = None): 
  self.decorator = decorator
  ...

And then implementing drawpoint as

  if self.decorator:
    privatedata.arrowcanvas.stroke(path.line_pt(x1, y1, x2, y2), 
privatedata.lineattrs + self.decorator)
  else:
    privatedata.arrowcanvas.stroke(path.line_pt(x1, y1, x2, y2), 
privatedata.lineattrs +
       [deco.earrow(privatedata.arrowattrs, size=self.arrowsize*size)]) 

there would be three possibilities giving maximal flexibility:

 - One passes no decorator: the arrow-class behaves as before
 - One passes "decorator = []": no arrows are plotted at all
 - One passes "decorator = [deco.earrow(....)]": An arbitrary arrow can
   be added (e.g. also the angle of the arrow can be changed from 45°).
 - One even could add more then one arrow-head to each line...


What do you think about this changement?

Axel

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to