[Matplotlib-users] redefining color keywords in stylesheets
pmhobson at gmail.com
Wed Apr 6 11:37:06 EDT 2016
I believe that seaborn achieves this through its set_color_codes function:
On Wed, Apr 6, 2016 at 7:52 AM, Benjamin Root <ben.v.root at gmail.com> wrote:
> We are working on a couple different features that would better address
> your problem. First, we are working on implementing a shorthand notation
> for properties that would reference elements in the property cycle. So,
> specifying `color=''` and `linewidth=''` would set those properties
> from the first element of the property cycle. There are some details that
> are still being worked out, though, and would likely land in version 2.1,
> but a preview/beta pared-down version might appear in v2.0.
> Another feature that has been discussed, but hasn't gotten very far is a
> "palette" concept. This would allow one to have multiple versions of that
> ColorConverter dictionary that would map the names to different rgb specs.
> I don't think this idea has gotten a pull request yet, and I would imagine
> that it shouldn't be too difficult to implement for those who might be
> interested in taking it on.
> Ben Root
> On Wed, Apr 6, 2016 at 8:25 AM, Pierre Haessig <pierre.haessig at crans.org>
>> 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 (
>> 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:
>> plot(x, y1) # will be blue
>> plot(x, y2) # will be green
>> 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
>> (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.)
>> Matplotlib-users mailing list
>> Matplotlib-users at python.org
> Matplotlib-users mailing list
> Matplotlib-users at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Matplotlib-users