On 7/10/06, John Hunter <[EMAIL PROTECTED]> wrote:
>>>>> "Fernando" == Fernando Perez <[EMAIL PROTECTED]> writes:Fernando> Hi all, this is somewhat of a half-feature request, Fernando> half-question. I just went through a rather unpleasant Fernando> exercise in trying to get a line plot with about 8 Fernando> traces generated for black and white printing. As it Fernando> turns out, mpl seems to only have 4 line styles ('-', Fernando> '--', '-.', ':'), which isn't really a whole lot Fernando> (compare this to gnuplot's extensive dashing support). Are you aware of the "dashes" property, which allows you to set the exact dash pattern you want. It's an arbitrary length sequence of alternating ink-on, ink-off, in points
In my humble defense, the fact that this is barely mentioned in the pylab tutorial, not at all in the plot docstring, and also not in Perry's tutorial, may have something to do with my not knowing about it ;)
# 5 points on, 2 off, 10 on, 5 off) plot(arange(20), '--', dashes=[5,2,10,5]) Fernando> Additionally, I'd like to suggest having a b/w mode, Fernando> where mpl's auto-selection of different colors for Fernando> successive line plots becomes a rotation of dashing Fernando> modes. Gnuplot's EPS backend has exactly this feature, This seems like a good idea -- if you define a nice sequence of dashes you want to cycle through, I'll build the rest of the infrastructure and make a figure property like iscolor.
Here's a specific, backwards-compatible proposal: why not add a new format string type, '-N', with N running 0-9, and '-0' being identical to a '-' (i.e., a continuous line). I think that having easy access to continuous plus 9 dashing patterns should be enough for most purposes (a plot with more than 10 traces on it is just unreadable anyway). This mode also makes it code-friendly, so that one can easily select any of the patterns with code of the type '-%s' % n where n is being looped over, or a key from a dict, whatever. I'm not quite sure what the best 9 patterns should be, so I'm attaching a script to make it easy to test a bunch of them in a hurry. This can help us find 9 distinctive ones (the gnuplot ones are good, but I think we can do better), to put them into this basic list. The little script can also be added to the examples dir to showcase the 9 basic patterns once selected (and you can make a figure for the tutorial with it :) Cheers, f
dashes.py
Description: Binary data
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users