Vertical lines

Hi all,

How can I add vertical/horizontal lines (x=constant, y=constant respectively) to an existing plot with matplotlib ?
A small example would be appreciated.

Is there a simple command to plot closed polygons, which are defined by the coordinates of the vertices ?
Thanks in advance.

Nils

Nils Wagner wrote:

How can I add vertical/horizontal lines (x=constant, y=constant respectively) to an existing plot with matplotlib ?

I've always done something like:

plot(x,y)
a=axis()
plot(a[0:2],[50,50],'k')

for example, to get a line at y=50. If there's something shorter I'm open to suggestions.

Nils Wagner wrote:

Hi all,

How can I add vertical/horizontal lines (x=constant, y=constant respectively) to an existing plot with matplotlib ?
A small example would be appreciated.

See http://matplotlib.sourceforge.net/matplotlib.pylab.html#-axhline
and http://matplotlib.sourceforge.net/matplotlib.pylab.html#-axvline

Is there a simple command to plot closed polygons, which are defined by the coordinates of the vertices ?

http://matplotlib.sourceforge.net/matplotlib.pylab.html#-fill

See axhspan_demo.py and fill_demo.py for example usage.

-Jeff

ยทยทยท

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/CDC R/CDC1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Web : www.cdc.noaa.gov/~jsw
Boulder, CO, USA 80303-3328 Office : Skaggs Research Cntr 1D-124