(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)
> 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.
> Matplotlib-users mailing list
My life in two words. "Interrupted Projects." -- WTW (quote originator)