Noob assist: trailing value graph

Hi-

I'm trying to plot an XY line graph with discrete XY pairs in it with a step response between each pair. In other words, on the range [X1,X2), it should have a horizontal line at Y1, at X2, the line goes vertical from Y1 to Y2, then on the range [X2,X3), it should have a horizontal line at Y2. I haven't seen any examples yet, and my forays into the documentation haven't yielded up a simple way to do this. Is there a simple option to do this, or do I have to pad my data with X1, X2-epsilon, X2, X3-epsilon, etc.

Thanks,
Ethan

What you're looking for is the step() plotting function:

      step(x, y, *args, **kwargs)

    Make a step plot. Additional keyword args to :func:`step` are the same
    as those for :func:`~matplotlib.pyplot.plot`.

    *x* and *y* must be 1-D sequences, and it is assumed, but not checked,
    that *x* is uniformly increasing.

    Keyword arguments:

    *where*: [ 'pre' | 'post' | 'mid' ]
      If 'pre', the interval from x[i] to x[i+1] has level y[i+1]

      If 'post', that interval has level y[i]

      If 'mid', the jumps in *y* occur half-way between the
      *x*-values.

Ryan

···

On Thu, Aug 19, 2010 at 5:03 PM, Ethan Swint <eswint@...3245...> wrote:

Hi-

I'm trying to plot an XY line graph with discrete XY pairs in it with a
step response between each pair. In other words, on the range [X1,X2),
it should have a horizontal line at Y1, at X2, the line goes vertical
from Y1 to Y2, then on the range [X2,X3), it should have a horizontal
line at Y2. I haven't seen any examples yet, and my forays into the
documentation haven't yielded up a simple way to do this. Is there a
simple option to do this, or do I have to pad my data with X1,
X2-epsilon, X2, X3-epsilon, etc.

--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

Aha! I knew it must be that simple, I just yet hadn't hit on step.

Thanks,
Ethan

···

On 08/19/2010 09:14 PM, Ryan May wrote:

On Thu, Aug 19, 2010 at 5:03 PM, Ethan Swint<eswint@...3245...> wrote:
   

Hi-

I'm trying to plot an XY line graph with discrete XY pairs in it with a
step response between each pair. In other words, on the range [X1,X2),
it should have a horizontal line at Y1, at X2, the line goes vertical
from Y1 to Y2, then on the range [X2,X3), it should have a horizontal
line at Y2. I haven't seen any examples yet, and my forays into the
documentation haven't yielded up a simple way to do this. Is there a
simple option to do this, or do I have to pad my data with X1,
X2-epsilon, X2, X3-epsilon, etc.
     

What you're looking for is the step() plotting function:

       step(x, y, *args, **kwargs)

     Make a step plot. Additional keyword args to :func:`step` are the same
     as those for :func:`~matplotlib.pyplot.plot`.

     *x* and *y* must be 1-D sequences, and it is assumed, but not checked,
     that *x* is uniformly increasing.

     Keyword arguments:

     *where*: [ 'pre' | 'post' | 'mid' ]
       If 'pre', the interval from x[i] to x[i+1] has level y[i+1]

       If 'post', that interval has level y[i]

       If 'mid', the jumps in *y* occur half-way between the
       *x*-values.

Ryan