From: <jk...@ik...> - 2007-02-23 11:10:18
|
The question of setting the color and line style sequences comes up every now and then, and although there are neat solutions like Fernando demonstrated, perhaps we should add support for them to matplotlib. The Matlab interface seems to be like this: >> figure >> set(gca, 'LineStyleOrder', '-o|-x|-^') % sequence of three line styles >> set(gca, 'ColorOrder', [1 0 0; 0 0 1]) % sequence of two colors (red and blue) >> set(gca, 'NextPlot', 'replacechildren') % don't reset the properties I just set >> plot(random(6)) This plots six lines with different combinations of style and color; the seventh line would look the same as the first. Probably you can avoid the NextPlot thing by setting DefaultLineStyleOrder on the root handle, but never mind. So, to make the interface familiar to Matlab users, I suggest to add properties line.linestyleorder and line.colororder that can take any sequences of linestyles and colors, or an n-by-3 array of rgb color values for the latter. I think the |-separated linestyles spec is a hack (necessary in Matlab because it cannot have vectors of strings because of the auto-flattening matrices) that we shouldn't emulate. How does that sound? -- Jouni K. Seppänen http://www.iki.fi/jks |