I created a wiki page on the scipy web site for people to upload tips, tricks, HOWTOs and recipes for matplotlib. Everyone is encouraged to contribute; you just need to get a login for the scipy page from http://www.scipy.org/wikis/topical_software/join_form . One easy way to contribute is to take a file from the examples directory and explain and annotate it and place it on the wiki. You can also upload images to show off your work. Beyond that, everything is fair game: from a tutorial freezing mpl with py2exe to embedding mpl in your favorite GUI to doing animations. To get the ball rolling, I cleaned up my last post to the mailing list and posted it with a screenshot http://www.scipy.org/wikis/topical_software/MatplotlibCookbook Thanks to scipy.org and enthought for hosting! JDH
Hi Is there another way to cycle through colors when repeating marker plots except c = 'bgrcmykw' for i in range(...): plot(..., '+-' + c[i]) cheers, steve
Hello Steve, Steve Schmerler schrieb: > Is there another way to cycle through colors when repeating marker plots > except > > c = 'bgrcmykw' > for i in range(...): > plot(..., '+-' + c[i]) You can of course specify the line properties via the keyword arguments 'linestyle', 'marker' and in this case 'color'. Since the kind of cycling you showed above is a good and working way, maybe you can explain in more detail what you are looking for. Best regards, Niklas Volbers.
Hi Well if you do lineplots # plot some lines x = [1,2,3] for i in range(...): plot(x) mpl changes the color of each line which doesn't happen in the case of marker plots. cheers, steve N. Volbers wrote: > Hello Steve, > > Steve Schmerler schrieb: > >> Is there another way to cycle through colors when repeating marker plots >> except >> >> c = 'bgrcmykw' >> for i in range(...): >> plot(..., '+-' + c[i]) > > > You can of course specify the line properties via the keyword arguments > 'linestyle', 'marker' and in this case 'color'. > Since the kind of cycling you showed above is a good and working way, > maybe you can explain in more detail what you are looking for. > > Best regards, > > Niklas Volbers. > >
>>>>> "Steve" == Steve Schmerler <el...@gm...> writes: Steve> Hi Well if you do lineplots Steve> # plot some lines x = [1,2,3] for i in range(...): Steve> plot(x) Steve> mpl changes the color of each line which doesn't happen in Steve> the case of marker plots. Actually something different is going on, but I had to grok through matplotlib.axes._process_plot_var_args to figure it out. The default color cycling happens when there is no string format applied, and is independent of markers and lines. For example, the following does not cycle either for i in range(4): plot(rand(5), rand(5), '-') because a format string is applied. You can make markers cycle too w/o a form string by changing the rc params so that the default makrer is not 'None' rcParams['lines.marker'] = 'o' rcParams['lines.linestyle'] = 'None' for i in range(4): plot(rand(5), rand(5)) Whether or not this is ideal behavior is debatable. But it is probably good enough since it is easy enough to force plot to act like you want by explicitly passing args, as you did. I think Niklas' suggestion of explicitly passing the kwargs for marker, linestyle, color, markerfacecolor and so on is a better approach than constructing arcane format strings. It is more readable and more flexible, because format strings limit you to a small set of colors whereas the kwargs approach supports arbitrary color arguments. JDH
Hi 1.) Hmmm the approach described below cycles colors for rcParams['lines.marker'] = 'o' but for rcParams['lines.marker'] = '+' I get black markers all the time (no cycling). 2.) I'm wondering if there is an 'elegant' way to force color cycling for things like for i in range(...): plot(...,'+') for j in range(...): plot(...,'x') or do I always have to set rcParams['lines.marker'] = <makrer> cheers, steve John Hunter wrote: >>>>>>"Steve" == Steve Schmerler <el...@gm...> writes: > > > Steve> Hi Well if you do lineplots > > Steve> # plot some lines x = [1,2,3] for i in range(...): > Steve> plot(x) > > Steve> mpl changes the color of each line which doesn't happen in > Steve> the case of marker plots. > > Actually something different is going on, but I had to grok through > matplotlib.axes._process_plot_var_args to figure it out. > > The default color cycling happens when there is no string format > applied, and is independent of markers and lines. For example, the > following does not cycle either > > for i in range(4): > plot(rand(5), rand(5), '-') > > > because a format string is applied. > > You can make markers cycle too w/o a form string by changing the rc > params so that the default makrer is not 'None' > > rcParams['lines.marker'] = 'o' > rcParams['lines.linestyle'] = 'None' > for i in range(4): > plot(rand(5), rand(5)) > > > Whether or not this is ideal behavior is debatable. But it is > probably good enough since it is easy enough to force plot to act like > you want by explicitly passing args, as you did. I think Niklas' > suggestion of explicitly passing the kwargs for marker, linestyle, > color, markerfacecolor and so on is a better approach than > constructing arcane format strings. It is more readable and more > flexible, because format strings limit you to a small set of colors > whereas the kwargs approach supports arbitrary color arguments. > > JDH > >
On Thursday 28 July 2005 03:57 pm, John Hunter wrote: > I created a wiki page on the scipy web site for people to upload tips, > tricks, HOWTOs and recipes for matplotlib. Everyone is encouraged to > contribute; you just need to get a login for the scipy page from > http://www.scipy.org/wikis/topical_software/join_form . > > One easy way to contribute is to take a file from the examples > directory and explain and annotate it and place it on the wiki. You > can also upload images to show off your work. Beyond that, everything > is fair game: from a tutorial freezing mpl with py2exe to embedding > mpl in your favorite GUI to doing animations. > > To get the ball rolling, I cleaned up my last post to the mailing list > and posted it with a screenshot > > http://www.scipy.org/wikis/topical_software/MatplotlibCookbook > > Thanks to scipy.org and enthought for hosting! Just to get the ball rolling (and because I couldnt sleep this morning), I made a page discussing TeX/LaTeX with mpl. http://www.scipy.org/Members/dsdale/textwithlatex/document_view How do I submit this so it can be found from the MatplotlibCookbook website? -- Darren
>>>>> "Darren" == Darren Dale <dd...@co...> writes: Darren> Just to get the ball rolling (and because I couldnt sleep Darren> this morning), I made a page discussing TeX/LaTeX with Darren> mpl. Darren> http://www.scipy.org/Members/dsdale/textwithlatex/document_view Great -- that is very useful. You may want to mention the dvipng requirement.... Darren> How do I submit this so it can be found from the Darren> MatplotlibCookbook website? Go to the cookbook page and add a link to it in the "Recipes" list. I think it would be nice to have all the recipes live as children of MatplotlibCookbook, so you may need to "reparent" your page (see the form at the bottom of the each wiki page) or if this doesn't work create a new blank page from the cookbook main page and just paste your entry in. I'm a bit of a scipy wiki newbie so I am not sure about all the details. Cheers, JDH
On Friday 29 July 2005 10:02 am, John Hunter wrote: > >>>>> "Darren" == Darren Dale <dd...@co...> writes: > > Darren> Just to get the ball rolling (and because I couldnt sleep > Darren> this morning), I made a page discussing TeX/LaTeX with > Darren> mpl. > > Darren> http://www.scipy.org/Members/dsdale/textwithlatex/document_view > > Great -- that is very useful. You may want to mention the dvipng > requirement.... > > Darren> How do I submit this so it can be found from the > Darren> MatplotlibCookbook website? > > Go to the cookbook page and add a link to it in the "Recipes" list. > > I think it would be nice to have all the recipes live as children of > MatplotlibCookbook, so you may need to "reparent" your page (see the > form at the bottom of the each wiki page) or if this doesn't work > create a new blank page from the cookbook main page and just paste > your entry in. I'm a bit of a scipy wiki newbie so I am not sure > about all the details. Just to be clear, I was completely uninitiated in working with wikis, so this seemed more difficult at first than it really is. I just added a comment to the MatplotlibCookbook page explaining how to add a new page. Its really a piece of cake. -- Darren