Re: [Matplotlib-users] Difference Between Scatter and Plot? (Zig-Zag)

 Re: [Matplotlib-users] Difference Between Scatter and Plot? (Zig-Zag) From: Wayne Watson - 2010-02-05 05:51:54 ```Simply explained what I'm looking for is a way to draw a zig-zag path indicating a path taken by a particle. Maybe this is best done with some tools outside of the normal plot capabilities? On 2/4/2010 9:02 PM, Wayne Watson wrote: > Is there a difference between the two (Subject). Perhaps plot connects > lines in the order of x? However, scatter does not connect any points? > -- My life in two words. "Interrupted Projects." -- WTW (quote originator) ```

 [Matplotlib-users] Difference Between Scatter and Plot? From: Wayne Watson - 2010-02-05 05:02:50 ```Is there a difference between the two (Subject). Perhaps plot connects lines in the order of x? However, scatter does not connect any points? -- My life in two words. "Interrupted Projects." -- WTW (quote originator) ```
 Re: [Matplotlib-users] Difference Between Scatter and Plot? (Zig-Zag) From: Wayne Watson - 2010-02-05 05:51:54 ```Simply explained what I'm looking for is a way to draw a zig-zag path indicating a path taken by a particle. Maybe this is best done with some tools outside of the normal plot capabilities? On 2/4/2010 9:02 PM, Wayne Watson wrote: > Is there a difference between the two (Subject). Perhaps plot connects > lines in the order of x? However, scatter does not connect any points? > -- My life in two words. "Interrupted Projects." -- WTW (quote originator) ```
 Re: [Matplotlib-users] Difference Between Scatter and Plot? (Zig-Zag) From: Eric Firing - 2010-02-05 07:32:40 ```Wayne Watson wrote: > Simply explained what I'm looking for is a way to draw a zig-zag path > indicating a path taken by a particle. Maybe this is best done with some > tools outside of the normal plot capabilities? Why doesn't plot handle this? What do you see as missing? > > On 2/4/2010 9:02 PM, Wayne Watson wrote: >> Is there a difference between the two (Subject). Perhaps plot connects >> lines in the order of x? However, scatter does not connect any points? >> Yes, plot connects points in the order in which they appear in the input sequence; scatter does not connect, and has additional capabilities for varying the symbol, size, and color. Eric > ```
 Re: [Matplotlib-users] Difference Between Scatter and Plot? (Zig-Zag) From: Alan G Isaac - 2010-02-05 13:24:26 ```On 2/5/2010 12:51 AM, Wayne Watson wrote: > what I'm looking for is a way to draw a zig-zag path > indicating a path taken by a particle Here is a 2d example: >>> import numpy as np >>> import matplotlib.pyplot as plt >>> locs = np.random.random_sample((2,30)) >>> locs = np.random.random_sample((2,30)) - 0.5 >>> locs = np.cumsum(locs, axis=-1) >>> x,y = locs >>> plt.plot(x,y) hth, Alan Isaac ```
 Re: [Matplotlib-users] Difference Between Scatter and Plot? (Zig-Zag)--Solution From: Wayne Watson - 2010-02-07 17:02:33 ```(I see I "forgot" to post this solution to the list. I really have quickly developed a dislike for having to go to extra lengths to make sure this happens. Perhaps one of my difficulties is that some people respond directly to me, and my mail filter shuttles the message to my matplotlib folder instead of my inbox, so it looks like someone has sent their response to the list.) Looking at your code suggests this is not what I want. The cumsum (summation) buffaloes me. I've just moved to Win7, and my PC is not yet ready for Python, so I can't really grasp what you have. From what I've been able to determine from a friend, who knows MatLab extremely well, this is not a difficult thing to do in MatLab, and likely in MPL. The creation of the path across a canvas/figure is done with plot. It will draw the zig-zag starting with x0,y0. To show the path clearly there are several ways to proceed. I can color each point successively with R,G, and B. The first red point, maybe with the help of an icon, says this is the start. Maybe a red circle. The next two points use a green and blue circle, probably of a different size, or maybe a square. R,G,B is repeated along the path. Another choice is to define an arrow and orient it in the direction of the next segment. An appealing way to do all of this is to pause drawing the next segment. That way, the dynamics of the path are clearly seen. On 2/5/2010 5:16 AM, Alan G Isaac wrote: > On 2/5/2010 12:51 AM, Wayne Watson wrote: > >> what I'm looking for is a way to draw a zig-zag path >> indicating a path taken by a particle >> > Here is a 2d example: > > >>> import numpy as np > >>> import matplotlib.pyplot as plt > >>> locs = np.random.random_sample((2,30)) > >>> locs = np.random.random_sample((2,30)) - 0.5 > >>> locs = np.cumsum(locs, axis=-1) > >>> x,y = locs > >>> plt.plot(x,y) > > hth, > Alan Isaac > > > ------------------------------------------------------------------------------ > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- My life in two words. "Interrupted Projects." -- WTW (quote originator) ```
 Re: [Matplotlib-users] Difference Between Scatter and Plot? (Zig-Zag)--Solution From: Alan G Isaac - 2010-02-07 17:55:01 ```Wayne Watson wrote: > The cumsum (summation) buffaloes me. That is just to create some artificial data, to illustrate. If you have the coordinates in a 2 by N array named `locs`, just use the last 2 lines. If you already have the coordinates separated into arrays x and y, just use the last line, i.e., plt.plot(x,y). Is that what you want? hth, Alan ```
 Re: [Matplotlib-users] Difference Between Scatter and Plot? (Zig-Zag)--Solution From: Wayne Watson - 2010-02-07 21:22:48 ```It's is simple as pie. Put three points on a sheet of paper. Draw a line with an arrow on it from any point to another. Draw a line from the last point to the third the same way. The method I described will work fine. I can do this. No need for you to attach arrows to what you've done. I think this is really wrapped up. On 2/7/2010 9:54 AM, Alan G Isaac wrote: > Wayne Watson wrote: > >> The cumsum (summation) buffaloes me. >> > That is just to create some artificial data, > to illustrate. If you have the coordinates > in a 2 by N array named `locs`, just use the > last 2 lines. If you already have the > coordinates separated into arrays x and y, > just use the last line, i.e., plt.plot(x,y). > Is that what you want? > > hth, > Alan > > ------------------------------------------------------------------------------ > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- My life in two words. "Interrupted Projects." -- WTW (quote originator) ```