On Dec 5, 2007 6:38 AM, Søren Nielsen <[EMAIL PROTECTED]> wrote: > Hi, > > Is it possible to expand the colorcycle that matplotlib uses by default? > > in axes.py, class _process_plot_var_args, def _clear_color_cycle(self) It > seems that self.colors are hardcoded to be self.colors = > ['b','g','r','c','m','y','k'] ... is there a way to extend this? (Without > changing the matplotlib code directly) I want to be able to extend it by ex. > dashed lines or others.. i sometimes have a large number of plots to do, and > the 7 default plot colors are not enough... > > I know I could manually make a handler in my program to handle the colors > when I plot... but it would seem nicer if I could just pass a list of plot > colors to matplotlib.
I just made a chance in svn to expose the default color list. Here is an ipython session that shows how to use it: In [1]: import matplotlib.axes as mplaxes In [2]: x, y = rand(2,100) In [3]: plot(x, y, 2*x, 2*y) Out[3]: [<matplotlib.lines.Line2D instance at 0x8f2dc8c>, <matplotlib.lines.Line2D instance at 0x8f2dd6c>] In [4]: mplaxes._process_plot_var_args.defaultColors = ['red', 'darkslategray', 'wheat'] In [5]: clf() In [6]: plot(x, y, 2*x, 2*y) Darren, we might want to expose this in the matplotlib.conf, but perhaps is it a rare enough request that it is enough to let people tweak it manually when needed. The only thing that is a bit ugly is that Axes._process_plot_var_args has the leading underscore indicating it should not be used outside of mpl, but this is easy enough to remedy... JDH ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users