[Matplotlib-users] redefining color keywords in stylesheets

Pierre Haessig pierre.haessig at crans.org
Wed Apr 6 08:25:23 EDT 2016


Hello,


I've a question about style sheets:

    /W//ould it be possible for stylesheets to redefine the
    colorkeywords ('r','g','b'...) to match their color design ?/

I believe this is not currently possible, is that right ?

The only thing that comes close is the modification of the dict
matplotlib.colors.ColorConverter.colors as discussed here
(http://stackoverflow.com/a/19626339/2822346)

The motivation for this would be to have a quick way to reuse colors
from the default color cycle. Indeed, the new Cycler objects are
powerful, but a bit heavy weight, especially for quick interactive
usage. This is pseudo code for the use case I've in mind:

    suplot(211)
    plot(x, y1) # will be blue
    plot(x, y2) # will be green

    subplot(212)
    plot(x, y3, 'r') # y3 should stand out. will be red instead of blue


With the classic style, this approach gives a coherent result, but using
for example 'seaborn-deep', the default red 'r' is out of place. So to
make the short color keywords useful again, it would be nice if
seeborn-deep could redefine 'r' to be the one used in its color cycle (a
nice dark purple red #8172B2).

for now, seeborn-deep defines the rcParams axes.prop_cycle'
cycler(u'color', [u'#4C72B0', u'#55A868', u'#C44E52', ...

and with this proposition, it could be instead
 cycler(u'color', [u'b', u'g', u'r'.... like for classic style (at least
for  the first 3 colors, not sure for the following colors)
but with extra entries in rcParams to define what b, g, r, ... should mean.


(Also, I apologize in advance if this kind of proposition has been
discussed already on the mailing list or on github. I understand there
was much discussion on the topic of style change and I was not much
following the discussion these last months.)


best,
Pierre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160406/37a80e83/attachment.html>


More information about the Matplotlib-users mailing list