On Sun, Mar 11, 2012 at 2:13 PM, Tony Yu tsy...@gmail.com wrote:
Is it possible to draw an arrow with a dashed line?
I tried using a fancy arrow patch and set the linestyle:
#~~~
import matplotlib.pyplot as plt
fix, ax = plt.subplots()
ax.set_xlim((-1,5))
ax.set_ylim((-5,3))
ax.annotate('simple', xy=(2., -1), xycoords='data',
xytext=(100, 60), textcoords='offset points',
size=20,
arrowprops=dict(arrowstyle=simple,
fc=0.6, ec=none, linestyle='dashed',
connectionstyle=arc3,rad=0.3),
)
plt.show()
#~~~
But the linestyle argument just gets ignored.
Is there a way to grab the connection path object and then change that to
a dashed line? Actually, I'm not even sure it's possible to set a linestyle
for a Path (since dashed lines are normally Line2D). Suggestions?
Thanks,
-Tony
Nevermind: I though arrowstyle='simple' and arrowstyle='-|' were the same
thing, but apparently not (I guess one draws the line as a patch, and the
other as a line). So the following works as expected:
#
import matplotlib.pyplot as plt
fix, ax = plt.subplots()
ax.set_xlim((-1,5))
ax.set_ylim((-5,3))
ax.annotate('simple', xy=(2., -1), xycoords='data',
xytext=(100, 60), textcoords='offset points',
size=20,
arrowprops=dict(arrowstyle=-|,
fc=k, ec=k, linestyle='dashed',
connectionstyle=arc3,rad=0.3),
)
plt.show()
#~~~
--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users