John Prince wrote:
First off,
thanks for matplotlib. It really is amazing.
I can’t seem to figure
out an acceptable sequence of dashes per the documentation:
‘dashes: sequence of on/off ink in points’
This is what I’m trying:`
`
mydashes = ['- ',
‘–’, '- ', ‘–’, '- ']
lines =
plot(*triplets)
for i in
range(len(lines)):
setp(lines[i],
dashes=mydashes[i])
I’m getting errors like:
ValueError: invalid
literal for float(): -
or a message about even numbers in the dash sequence being required
when I don’t use even-length strings.
I really need about 5-10 different dash sequences to lines in a
publication and the defaults are not quite enough.
Hello John,
I found this in the online documentation of the pylab.plot() function:
`The following line styles are supported:
- : solid line
-- : dashed line
-. : dash-dot line
: : dotted line
. : points
, : pixels
o : circle symbols
^ : triangle up symbols
v : triangle down symbols
< : triangle left symbols
> : triangle right symbols
s : square symbols
+ : plus symbols
x : cross symbols
D : diamond symbols
d : thin diamond symbols
1 : tripod down symbols
2 : tripod up symbols
3 : tripod left symbols
4 : tripod right symbols
h : hexagon symbols
H : rotated hexagon symbols
p : pentagon symbols
> : vertical line symbols
_ : horizontal line symbols
steps : use gnuplot style 'steps' # kwarg only
The following color abbreviations are supported
b : blue
g : green
r : red
c : cyan
m : magenta
y : yellow
k : black
w : white
In addition, you can specify colors in many weird and
wonderful ways, including full names ‘green’, hex strings
‘#008000’, RGB or RGBA tuples (0,1,0,1) or grayscale
intensities as a string ‘0.8’. Of these, the string
specifications can be used in place of a fmt group, but the
tuple forms can be used only as kwargs.
Line styles and colors are combined in a single format string, as in
‘bo’ for blue circles.
The **kwargs can be used to set line properties (any property that has
a set_* method). You can use this to set a line label (for auto
legends), linewidth, anitialising, marker face color, etc. Here is an
example:
[plot](http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-plot)([1,2,3], [1,2,3], 'go-', label='line 1', linewidth=2)
[plot](http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-plot)([1,2,3], [1,4,9], 'rs', label='line 2')
[axis](http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-axis)([0, 4, 0, 10])
[legend](http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-legend)()
HTH,
– jv
`
···
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/Matplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users