SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: John P. <jp...@ic...> - 2008年01月31日 19:53:35
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.
Thanks,
John
From: Jim V. <Jim...@no...> - 2008年01月31日 20:13:22
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
>
> Thanks,
> John
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: John P. <jp...@ic...> - 2008年01月31日 20:22:38
> 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
>
Thanks for the reply. Those are the formatting codes one can use by
default. However, there are only 4 dash types accessible from these codes:
solid, dashed, dash-dot, dotted. I think there is a way to set arbitrary
dash-dot lines (say, '-..-....-') using the 'setp' command with the 'dashes'
argument. I just don't know what acceptable parameters for that argument
are. I'm hoping someone knows.
Thanks,
John
From: Alan G I. <ai...@am...> - 2008年01月31日 20:31:32
On 2008年1月31日, John Prince apparently wrote:
> I think there is a way to set arbitrary 
> dash-dot lines 
Use numbers:
http://matplotlib.sourceforge.net/matplotlib.lines.html
set_dashes(self, seq)
 Set the dash sequence, sequence of dashes with on off ink in
 points. If seq is empty or if seq = (None, None), the
 linestyle will be set to solid.
 
 ACCEPTS: sequence of on/off ink in points
Note: 1pt = 1/72 inch
hth,
Alan Isaac
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /