From: Eric F. <ef...@ha...> - 2007-02-23 18:40:27
|
Jouni K. Seppänen wrote: > 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? > Are you talking about Axes properties (instance attributes) or rcParam entries or both? In any case, I agree that built-in support would easy to provide and would help enough people to be worthwhile. Eric |