From: Gus I. <gus...@gm...> - 2010-09-26 06:11:35
|
I'd like to plot some arrows. I can use the pyplot.arrow function but it does not give an arrow head. I am trying to use FancyArrow in the following way: import matplotlib as mpl import matplotlib.pyplot as plt plt.figure(None) ax = plt.gca() arr = mpl.patches.FancyArrowPatch((0,0),(3,2),arrowstyle='simple') ax.add_patch(arr) plt.show() but I get "ValueError: Given lines do not intersect" in the bezier.py file. (Full traceback below) Thanks for any hints! Gus Traceback (most recent call last): File "M:\mypy\minimum.py", line 8, in <module> ax.add_patch(arr) File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1453, in add_patch self._update_patch_limits(p) File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1469, in _update_patch_limits vertices = patch.get_path().vertices File "C:\Python26\lib\site-packages\matplotlib\patches.py", line 3792, in get_path _path, fillable = self.get_path_in_displaycoord() File "C:\Python26\lib\site-packages\matplotlib\patches.py", line 3822, in get_path_in_displaycoord self.get_mutation_aspect() File "C:\Python26\lib\site-packages\matplotlib\patches.py", line 2845, in __call__ return self.transmute(path, mutation_size, linewidth) File "C:\Python26\lib\site-packages\matplotlib\patches.py", line 3384, in transmute tail_left, tail_right = get_parallels(arrow_out, tail_width/2.) File "C:\Python26\lib\site-packages\matplotlib\bezier.py", line 359, in get_parallels c2x_left, c2y_left, cos_t2, sin_t2) File "C:\Python26\lib\site-packages\matplotlib\bezier.py", line 34, in get_intersection raise ValueError("Given lines do not intersect") ValueError: Given lines do not intersect |
From: Marius 't H. <M.t...@ai...> - 2010-09-26 17:01:54
|
The function arrow() works for me (Python 2.6.5, matplotlib 99.1.2). Perhaps something in your installation needs to be changed. You might try pylab.Arrow() to create patches or perhaps quiver() which draws a whole set of arrows. On 09/26/2010 08:11 AM, Gus Ishere wrote: > I'd like to plot some arrows. I can use the pyplot.arrow function but > it does not give an arrow head. I am trying to use FancyArrow in the > following way: > > import matplotlib as mpl > import matplotlib.pyplot as plt > > plt.figure(None) > ax = plt.gca() > > arr = mpl.patches.FancyArrowPatch((0,0),(3,2),arrowstyle='simple') > ax.add_patch(arr) > > plt.show() > > but I get "ValueError: Given lines do not intersect" in the bezier.py > file. (Full traceback below) > > Thanks for any hints! > Gus > > > > Traceback (most recent call last): > File "M:\mypy\minimum.py", line 8, in <module> > ax.add_patch(arr) > File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1453, > in add_patch > self._update_patch_limits(p) > File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1469, > in _update_patch_limits > vertices = patch.get_path().vertices > File "C:\Python26\lib\site-packages\matplotlib\patches.py", line > 3792, in get_path > _path, fillable = self.get_path_in_displaycoord() > File "C:\Python26\lib\site-packages\matplotlib\patches.py", line > 3822, in get_path_in_displaycoord > self.get_mutation_aspect() > File "C:\Python26\lib\site-packages\matplotlib\patches.py", line > 2845, in __call__ > return self.transmute(path, mutation_size, linewidth) > File "C:\Python26\lib\site-packages\matplotlib\patches.py", line > 3384, in transmute > tail_left, tail_right = get_parallels(arrow_out, tail_width/2.) > File "C:\Python26\lib\site-packages\matplotlib\bezier.py", line 359, > in get_parallels > c2x_left, c2y_left, cos_t2, sin_t2) > File "C:\Python26\lib\site-packages\matplotlib\bezier.py", line 34, > in get_intersection > raise ValueError("Given lines do not intersect") > ValueError: Given lines do not intersect > > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Jae-Joon L. <lee...@gm...> - 2010-09-27 02:42:58
|
---------- Forwarded message ---------- From: Jae-Joon Lee <lee...@gm...> Date: Mon, Sep 27, 2010 at 11:41 AM Subject: Re: [Matplotlib-users] Plotting Arrows To: Gus Ishere <gus...@gm...> This turns out to be a bug. And I think fixed it with r8720 and r8721. Meanwhile, try to use other arrowstyles (e.g., "->") or other arrow commands. Also, the recommend way is to use "annotate" command. For example, ax.annotate("", (0, 0), (3,2), arrowprops=dict(arrowstyle="->")) Regards, -JJ On Sun, Sep 26, 2010 at 3:11 PM, Gus Ishere <gus...@gm...> wrote: > I'd like to plot some arrows. I can use the pyplot.arrow function but it > does not give an arrow head. I am trying to use FancyArrow in the following > way: > import matplotlib as mpl > import matplotlib.pyplot as plt > plt.figure(None) > ax = plt.gca() > arr = mpl.patches.FancyArrowPatch((0,0),(3,2),arrowstyle='simple') > ax.add_patch(arr) > plt.show() > but I get "ValueError: Given lines do not intersect" in the bezier.py file. > (Full traceback below) > Thanks for any hints! > Gus > > > Traceback (most recent call last): > File "M:\mypy\minimum.py", line 8, in <module> > ax.add_patch(arr) > File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1453, in > add_patch > self._update_patch_limits(p) > File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1469, in > _update_patch_limits > vertices = patch.get_path().vertices > File "C:\Python26\lib\site-packages\matplotlib\patches.py", line 3792, in > get_path > _path, fillable = self.get_path_in_displaycoord() > File "C:\Python26\lib\site-packages\matplotlib\patches.py", line 3822, in > get_path_in_displaycoord > self.get_mutation_aspect() > File "C:\Python26\lib\site-packages\matplotlib\patches.py", line 2845, in > __call__ > return self.transmute(path, mutation_size, linewidth) > File "C:\Python26\lib\site-packages\matplotlib\patches.py", line 3384, in > transmute > tail_left, tail_right = get_parallels(arrow_out, tail_width/2.) > File "C:\Python26\lib\site-packages\matplotlib\bezier.py", line 359, in > get_parallels > c2x_left, c2y_left, cos_t2, sin_t2) > File "C:\Python26\lib\site-packages\matplotlib\bezier.py", line 34, in > get_intersection > raise ValueError("Given lines do not intersect") > ValueError: Given lines do not intersect > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |