Re: [Matplotlib-users] drawing arrows

 Re: [Matplotlib-users] drawing arrows From: Jae-Joon Lee - 2009-10-27 03:30:43 The only case I can think of now is that the two points are too close (with in a few points). This could happen during the "shrink", or during the "mutate" (http://matplotlib.sourceforge.net/users/annotations_guide.html#annotating-with-arrow). But it would be great if you can pinpoint this down and post a script that reproduce the problem. Regards, -JJ On Mon, Oct 26, 2009 at 1:57 PM, per freem wrote: > hi all, > > i am trying to plot a series of arrows between points on a scatter > plot, using the following code: > > import matplotlib.pyplot as plt > from matplotlib.patches import FancyArrowPatch > from numpy import * > from scipy import * > > def plot_arrows(init_val, all_vals, c='k'): >    plt.figure() >    ax = plt.gca() >    prev_val = init_val >    for x, y in all_vals[1:]: >        ax = plt.gca() >        start_coord = prev_val >        plt.scatter(start_coord[0], start_coord[1], c=c) >        end_coord = (x, y) >        ax.add_patch(FancyArrowPatch(start_coord, end_coord, >                                     arrowstyle='->', edgecolor=c, > facecolor=c, mutation_scale=10)) >        prev_val = end_coord >    plt.scatter(all_vals[-1][0], all_vals[-1][1], c=c) > > points = rand(5,2) > init = [0, 0] > plot_arrows(init, points) > plt.show() > > this usually works, but sometimes when i give it a set of points (not > necessarily ones generated randomly), then it gives me the error: > > Library/Python/2.5/site-packages/matplotlib/bezier.pyc in > split_path_inout(path, inside, tolerence, reorder_inout) >    265 >    266     if bezier_path is None: > --> 267         raise ValueError("The path does not seem to intersect > with the patch") >    268 >    269     bp = zip(bezier_path[::2], bezier_path[1::2]) > > ValueError: The path does not seem to intersect with the patch > > any idea what could be causing this? it seems like any arbitrary set > of points should work here, since you can always draw an arrow between > any two points.... not sure what is the root of this error. any help > would be really appreciated. thank you. > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >