Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: aditya bhargava <aditya@we...>  20100502 18:19:38
Attachments:
Message as HTML

Is there a straightforward way of plotting a vector in matplotlib? Suppose I want to plot the vector [1 2]'. If I pass this vector in to plot(), I get the line that passes through (0,1), (1,2). Instead I want the line that passes through (0,0),(1,2). Aditya wefoundland.com 
From: Matthias Michler <MatthiasM<ichler@gm...>  20100503 08:21:36
Attachments:
simple_vector_class.py

On Sunday 02 May 2010 20:19:29 aditya bhargava wrote: > Is there a straightforward way of plotting a vector in matplotlib? Suppose > I want to plot the vector [1 2]'. If I pass this vector in to plot(), I get > the line that passes through (0,1), (1,2). Instead I want the line that > passes through (0,0),(1,2). > > > Aditya Hi Aditya, if you pass a 1dimensional interatable to the plotfunction the elements are plotted over their indices. In your case [1, 2] gives the yvalues and the indices [0, 1] are used as xvalues. I don't know if there is some kind of vector class yet, but meanwhile you could set up your one like in the attached small example. Kind regards, Matthias 
From: Johan Grönqvist <johan.gronqvist@gm...>  20100503 08:40:25

20100502 20:19, aditya bhargava skrev: > Is there a straightforward way of plotting a vector in matplotlib? > Suppose I want to plot the vector [1 2]'. If I pass this vector in to > plot(), I get the line that passes through (0,1), (1,2). Instead I want > the line that passes through (0,0),(1,2). > I use pyplot.Arrow to visualize displacement fields. This is a snippet copied from the code I use (it sits in a loop over all vectors I want to plot): arr = plt.Arrow(x, y, dx, dy) plt.gca().add_patch(arr) In your case, you would have (x, y) = (0, 0) and (dx, dy) = (1, 2). Regards Johan 
From: aditya bhargava <bluemangroupie@gm...>  20100504 01:03:11
Attachments:
Message as HTML

Thanks Johan and Matthias, I was just wondering if there was a builtin way to do this in matplotlib. It seems like it would be a useful method to have. Adit 2010/5/3 Johan Grönqvist <johan.gronqvist@...> > 20100502 20:19, aditya bhargava skrev: > > Is there a straightforward way of plotting a vector in matplotlib? > > Suppose I want to plot the vector [1 2]'. If I pass this vector in to > > plot(), I get the line that passes through (0,1), (1,2). Instead I want > > the line that passes through (0,0),(1,2). > > > > I use pyplot.Arrow to visualize displacement fields. > > This is a snippet copied from the code I use (it sits in a loop over all > vectors I want to plot): > > > arr = plt.Arrow(x, y, dx, dy) > plt.gca().add_patch(arr) > > In your case, you would have (x, y) = (0, 0) and (dx, dy) = (1, 2). > > Regards > > Johan > > > >  > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers >  wefoundland.com 
From: Joe Kington <jkington@wi...>  20100504 02:14:09
Attachments:
Message as HTML

Isn't that what quiver<http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.quiver>does? Or am I misunderstanding the question? 2010/5/3 aditya bhargava <bluemangroupie@...> > Thanks Johan and Matthias, > I was just wondering if there was a builtin way to do this in matplotlib. > It seems like it would be a useful method to have. > > Adit > > > 2010/5/3 Johan Grönqvist <johan.gronqvist@...> > > 20100502 20:19, aditya bhargava skrev: >> > Is there a straightforward way of plotting a vector in matplotlib? >> > Suppose I want to plot the vector [1 2]'. If I pass this vector in to >> > plot(), I get the line that passes through (0,1), (1,2). Instead I want >> > the line that passes through (0,0),(1,2). >> > >> >> I use pyplot.Arrow to visualize displacement fields. >> >> This is a snippet copied from the code I use (it sits in a loop over all >> vectors I want to plot): >> >> >> arr = plt.Arrow(x, y, dx, dy) >> plt.gca().add_patch(arr) >> >> In your case, you would have (x, y) = (0, 0) and (dx, dy) = (1, 2). >> >> Regards >> >> Johan >> >> >> >>  >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> > > > >  > wefoundland.com > > >  > > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > > 
From: aditya bhargava <bluemangroupie@gm...>  20100504 03:12:05
Attachments:
Message as HTML

I don't think that plots a vector. Here's the sort of thing I was looking for: http://www.mathworks.com/matlabcentral/fx_files/23608/1/content/html/drawLAInro_02.png Of course it doesn't need to be a point...it can be a line or a line segment too. Adit On Mon, May 3, 2010 at 9:13 PM, Joe Kington <jkington@...> wrote: > Isn't that what quiver<http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.quiver>does? Or am I misunderstanding the question? > > 2010/5/3 aditya bhargava <bluemangroupie@...> > >> Thanks Johan and Matthias, >> I was just wondering if there was a builtin way to do this in matplotlib. >> It seems like it would be a useful method to have. >> >> Adit >> >> >> 2010/5/3 Johan Grönqvist <johan.gronqvist@...> >> >> 20100502 20:19, aditya bhargava skrev: >>> > Is there a straightforward way of plotting a vector in matplotlib? >>> > Suppose I want to plot the vector [1 2]'. If I pass this vector in to >>> > plot(), I get the line that passes through (0,1), (1,2). Instead I want >>> > the line that passes through (0,0),(1,2). >>> > >>> >>> I use pyplot.Arrow to visualize displacement fields. >>> >>> This is a snippet copied from the code I use (it sits in a loop over all >>> vectors I want to plot): >>> >>> >>> arr = plt.Arrow(x, y, dx, dy) >>> plt.gca().add_patch(arr) >>> >>> In your case, you would have (x, y) = (0, 0) and (dx, dy) = (1, 2). >>> >>> Regards >>> >>> Johan >>> >>> >>> >>>  >>> _______________________________________________ >>> Matplotlibusers mailing list >>> Matplotlibusers@... >>> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >>> >> >> >> >>  >> wefoundland.com >> >> >>  >> >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> >> >  wefoundland.com 
From: Johan Grönqvist <johan.gronqvist@gm...>  20100504 05:20:14

20100504 04:13, Joe Kington skrev: > Isn't that what quiver > <http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.quiver>; > does? Or am I misunderstanding the question? Regardless of the OPs question, the quiver seems to be the solution I should use for my purpose. Thanks. / Johan 
Sign up for the SourceForge newsletter:
No, thanks