Setting dash size and gap of dashed line in matplotlib

hi all,

I am plotting certain dashed lines in matplotlib, using:

plt.plot(x, y, '--')

I'd like to set the dash size (i.e. length of each dash) and the gap
between the dashes of the plotted line. Is there a way to set this
from matplotlib?

thanks.

per freem wrote:

hi all,

I am plotting certain dashed lines in matplotlib, using:

plt.plot(x, y, '--')

I'd like to set the dash size (i.e. length of each dash) and the gap
between the dashes of the plotted line. Is there a way to set this
from matplotlib?

plt.plot([0,1], [2,3], '--', dashes=(10,20))

The dashes kwarg sets a Line2D parameter. See
http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.lines.Line2D.set_dashes

Eric

ยทยทยท

thanks.

------------------------------------------------------------------------------
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@lists.sourceforge.net
matplotlib-users List Signup and Options