Most of the plots I need to make for work have very different x and y axis
scales, and under these conditions, the pyplot.arrow function (which I think
is a FancyArrow) makes arrows where the heads are pretty distorted. (MPL
version 0.99.1 -- Windows; version 0.99.1.1-r1 -- Gentoo)

I've spent quite a bit of time learning about the different arrow classes --
FancyArrow, YAArrow, FancyArrowPatch -- and I've found that the
FancyArrowPatch gives arrows that do not look distorted under these
conditions. For examples:

import matplotlib.pyplot as plt
import matplotlib.patches as mpp
fig = plt.figure()
ax=fig.add_subplot(111)
ax.axis([520,580, 0,0.2])
a = plt.arrow(550,0.06,15,0.1, width=0.01, head_length=1.)
ax.add_patch(a)
b = mpp.YAArrow(fig, (555,0.16), (540,0.06), width=0.01, headwidth=0.03)
ax.add_patch(b)
c = mpp.FancyArrowPatch((530,0.06), (545,0.16), arrowstyle='-|>', lw=2,
mutation_scale=50)
ax.add_patch(c)
plt.show()

However, this leads to my questions:

1) Are there any plans or would it make sense to add another keyword to the
pyplot.arrow function that allows you to choose the arrow class you would
like to use? The default could be FancyArrow so that the original usage of
pyplot.arrow will not be affected. The axes.arrow function - which it looks
like it gets called by the pyplot.arrow function - could then convert the
input arguments into the form necessary for the class you choose.

2) Or... Is there a simple way that you can call the arrow function with
start and end points in data coordinates, but have the arrow parameters
calculated in normalized figure coordinates? I think FancyArrow calculates
the head and body points using a line perpendicular to the line of the arrow
in data coordinates, which I think is the source of my problem (? -- at
least that is what I found doing some test calculations on my own). However,
if I call the pyplot.arrow function with the following keywords,
'trasform=fig.transFigure, figure=fig' (as per the Artist tutorial, see
below), then the arrow looks okay, but it needs to be positioned in
normalized figure coordinates and it does not move when you zoom or
translate the plot.

d = plt.arrow(0.15, 0.3, 0.15, 0.4, head_width=0.05,
transform=fig.transFigure, figure=fig)
ax.add_patch(d)

For me, this is not a really big concern now that I figured it out, but I'm
trying to teach my coworkers how to use Python/Matplotlib, and although they
are interested in learning both, most of them are not and probably never
will be really strong Python programmers. As a consequence, I think that all
of the different arrow options and usages outside of pyplot.arrow will be a
bit confusing for them... (I know it was for me at first...)

Sorry for the long question message. I hope it was clear.

Ryan 

P.S. As this is my first message to the list, I wanted to thank everyone who
contributes to this great project. I'm a fairly new Python and Matplotlib
user (only about 7 or 8 months for Python, less for MPL), and the
combination of Python/Numpy/Scipy/Matplotlib is by far the most useful tool
that I've learned in quite a long time. Hopefully, someday I'll be skilled
enough to contribute something back.


-- 
View this message in context: 
http://old.nabble.com/Arrow-question-request-tp27590334p27590334.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to