Fowarding to the list ...

---------- Forwarded message ----------
From: Antonino Ingargiola <[EMAIL PROTECTED]>
Date: 4-mag-2007 11.12
Subject: Re: [Matplotlib-users] matplolib equivalent of gnuplot's impulse
To: Emmanuel <[EMAIL PROTECTED]>


Hi,

On 5/3/07, Emmanuel <[EMAIL PROTECTED]> wrote:
> With gnuplot one can do a plot like that :
>
> http://www.deqnotes.net/gnuplot/images/impulses.png
>
> It is using option "with impulse".
>  Is there an equivalent in matplotlib?

Maybe not directly as a "plot style". But...

If you need to fill the curve with a color you can see this example:

http://matplotlib.sourceforge.net/screenshots/fill_demo.py

If you need the "bar" itself you can use the bar() function.

If you need impulses composed by just "a line" you can use this function:

def impulse(X, Y, color='blue', **kwargs):
    """Plot an "impulse" graph similar to the gnuplot 'impulse' function."""
    if len(X) != len(Y):
        raise ValueError, "X and Y data must be of the same length."

    ax = gca()
    for x, y in zip(X, Y):
        ax.plot([x, x], [0, y], color=color, **kwargs)

You can pass to it any plot() keyword-argument to customize line style.


Cheers,

  ~ Antonio

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to