easily accessing the default color cycle list

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

easily accessing the default color cycle list

Michael Kaufman
Hi All,

With the new color cycle, it's no longer super easy for me to manually
set plotting colors (that still conform to the new default colors)
without a cheat sheet.

Recently I've been doing:

cols = rcParams['axes.prop_cycle'].by_key()['color']

to get the list. This is something that I cannot remember and have
search through old code to find every time.

Is there an easier way to access this list? Something like:

from matplotlib.colors import color_cycle
cols = color_cycle('default')

would be quite nice. Maybe something like this already exists?


M
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: easily accessing the default color cycle list

Phlya
Hi Michael,

I think the new colours can be used as 'C0', 'C1', etc, if that helps?

Ilya

2017-01-10 17:57 GMT+00:00 Michael Kaufman <[hidden email]>:
Hi All,

With the new color cycle, it's no longer super easy for me to manually set plotting colors (that still conform to the new default colors) without a cheat sheet.

Recently I've been doing:

cols = rcParams['axes.prop_cycle'].by_key()['color']

to get the list. This is something that I cannot remember and have search through old code to find every time.

Is there an easier way to access this list? Something like:

from matplotlib.colors import color_cycle
cols = color_cycle('default')

would be quite nice. Maybe something like this already exists?


M
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users


_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: easily accessing the default color cycle list

Michael Kaufman
That helps very much actually. Thanks.

Is this documented somewhere? It's not in plot() help.

M

On 1/10/17 1:01 PM, Ilya Flyamer wrote:

> Hi Michael,
>
> I think the new colours can be used as 'C0', 'C1', etc, if that helps?
>
> Ilya
>
> 2017-01-10 17:57 GMT+00:00 Michael Kaufman <[hidden email]
> <mailto:[hidden email]>>:
>
>     Hi All,
>
>     With the new color cycle, it's no longer super easy for me to
>     manually set plotting colors (that still conform to the new default
>     colors) without a cheat sheet.
>
>     Recently I've been doing:
>
>     cols = rcParams['axes.prop_cycle'].by_key()['color']
>
>     to get the list. This is something that I cannot remember and have
>     search through old code to find every time.
>
>     Is there an easier way to access this list? Something like:
>
>     from matplotlib.colors import color_cycle
>     cols = color_cycle('default')
>
>     would be quite nice. Maybe something like this already exists?
>
>
>     M
>     _______________________________________________
>     Matplotlib-users mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://mail.python.org/mailman/listinfo/matplotlib-users
>     <https://mail.python.org/mailman/listinfo/matplotlib-users>
>
>

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: easily accessing the default color cycle list

Phlya

2017-01-10 18:04 GMT+00:00 Michael Kaufman <[hidden email]>:
That helps very much actually. Thanks.

Is this documented somewhere? It's not in plot() help.

M

On 1/10/17 1:01 PM, Ilya Flyamer wrote:
Hi Michael,

I think the new colours can be used as 'C0', 'C1', etc, if that helps?

Ilya

2017-01-10 17:57 GMT+00:00 Michael Kaufman <[hidden email]
<mailto:[hidden email]>>:

    Hi All,

    With the new color cycle, it's no longer super easy for me to
    manually set plotting colors (that still conform to the new default
    colors) without a cheat sheet.

    Recently I've been doing:

    cols = rcParams['axes.prop_cycle'].by_key()['color']

    to get the list. This is something that I cannot remember and have
    search through old code to find every time.

    Is there an easier way to access this list? Something like:

    from matplotlib.colors import color_cycle
    cols = color_cycle('default')

    would be quite nice. Maybe something like this already exists?


    M
    _______________________________________________
    Matplotlib-users mailing list
    [hidden email] <mailto:[hidden email]>
    https://mail.python.org/mailman/listinfo/matplotlib-users
    <https://mail.python.org/mailman/listinfo/matplotlib-users>





_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: easily accessing the default color cycle list

Benjamin Root
In reply to this post by Phlya
This feature will be in the upcoming 2.0 release. It isn't in the 1.5.x series.

On Tue, Jan 10, 2017 at 1:01 PM, Ilya Flyamer <[hidden email]> wrote:
Hi Michael,

I think the new colours can be used as 'C0', 'C1', etc, if that helps?

Ilya

2017-01-10 17:57 GMT+00:00 Michael Kaufman <[hidden email]>:
Hi All,

With the new color cycle, it's no longer super easy for me to manually set plotting colors (that still conform to the new default colors) without a cheat sheet.

Recently I've been doing:

cols = rcParams['axes.prop_cycle'].by_key()['color']

to get the list. This is something that I cannot remember and have search through old code to find every time.

Is there an easier way to access this list? Something like:

from matplotlib.colors import color_cycle
cols = color_cycle('default')

would be quite nice. Maybe something like this already exists?


M
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users


_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users



_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: easily accessing the default color cycle list

Michael Kaufman
Sure, but since I'm using a version of mpl that supports 'CN' color
designations, it ought to at least be in documentation that's accessible
via help().

M

On 1/10/17 1:10 PM, Benjamin Root wrote:

> This feature will be in the upcoming 2.0 release. It isn't in the 1.5.x
> series.
>
> On Tue, Jan 10, 2017 at 1:01 PM, Ilya Flyamer <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi Michael,
>
>     I think the new colours can be used as 'C0', 'C1', etc, if that helps?
>
>     Ilya
>
>     2017-01-10 17:57 GMT+00:00 Michael Kaufman <[hidden email]
>     <mailto:[hidden email]>>:
>
>         Hi All,
>
>         With the new color cycle, it's no longer super easy for me to
>         manually set plotting colors (that still conform to the new
>         default colors) without a cheat sheet.
>
>         Recently I've been doing:
>
>         cols = rcParams['axes.prop_cycle'].by_key()['color']
>
>         to get the list. This is something that I cannot remember and
>         have search through old code to find every time.
>
>         Is there an easier way to access this list? Something like:
>
>         from matplotlib.colors import color_cycle
>         cols = color_cycle('default')
>
>         would be quite nice. Maybe something like this already exists?
>
>
>         M
>         _______________________________________________
>         Matplotlib-users mailing list
>         [hidden email] <mailto:[hidden email]>
>         https://mail.python.org/mailman/listinfo/matplotlib-users
>         <https://mail.python.org/mailman/listinfo/matplotlib-users>
>
>
>
>     _______________________________________________
>     Matplotlib-users mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://mail.python.org/mailman/listinfo/matplotlib-users
>     <https://mail.python.org/mailman/listinfo/matplotlib-users>
>
>

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: easily accessing the default color cycle list

tcaswell
It is also documented at http://matplotlib.org/2.0.0rc2/users/colors.html which is too verbose to put into the docstring of every method (almost all of them) that takes in a color-like input.

Additionally, we will be adding alias to access the color by name for 2.0 final (see https://github.com/matplotlib/matplotlib/pull/7639 )

Tom

On Tue, Jan 10, 2017 at 1:14 PM Michael Kaufman <[hidden email]> wrote:
Sure, but since I'm using a version of mpl that supports 'CN' color
designations, it ought to at least be in documentation that's accessible
via help().

M

On 1/10/17 1:10 PM, Benjamin Root wrote:
> This feature will be in the upcoming 2.0 release. It isn't in the 1.5.x
> series.
>
> On Tue, Jan 10, 2017 at 1:01 PM, Ilya Flyamer <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi Michael,
>
>     I think the new colours can be used as 'C0', 'C1', etc, if that helps?
>
>     Ilya
>
>     2017-01-10 17:57 GMT+00:00 Michael Kaufman <[hidden email]
>     <mailto:[hidden email]>>:
>
>         Hi All,
>
>         With the new color cycle, it's no longer super easy for me to
>         manually set plotting colors (that still conform to the new
>         default colors) without a cheat sheet.
>
>         Recently I've been doing:
>
>         cols = rcParams['axes.prop_cycle'].by_key()['color']
>
>         to get the list. This is something that I cannot remember and
>         have search through old code to find every time.
>
>         Is there an easier way to access this list? Something like:
>
>         from matplotlib.colors import color_cycle
>         cols = color_cycle('default')
>
>         would be quite nice. Maybe something like this already exists?
>
>
>         M
>         _______________________________________________
>         Matplotlib-users mailing list
>         [hidden email] <mailto:[hidden email]>
>         https://mail.python.org/mailman/listinfo/matplotlib-users
>         <https://mail.python.org/mailman/listinfo/matplotlib-users>
>
>
>
>     _______________________________________________
>     Matplotlib-users mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://mail.python.org/mailman/listinfo/matplotlib-users
>     <https://mail.python.org/mailman/listinfo/matplotlib-users>
>
>

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: easily accessing the default color cycle list

Michael Kaufman
On 1/10/17 1:18 PM, Thomas Caswell wrote:
> It is also documented
> at http://matplotlib.org/2.0.0rc2/users/colors.html which is too verbose
> to put into the docstring of every method (almost all of them) that
> takes in a color-like input.
>

Ok, but we've already got a nice paragraph:

     In addition, you can specify colors in many weird and
     wonderful ways, including full names (``'green'``), hex
     strings (``'#008000'``), RGB or RGBA tuples (``(0,1,0,1)``) or
     grayscale intensities as a string (``'0.8'``).  Of these, the
     string specifications can be used in place of a ``fmt`` group,
     but the tuple forms can be used only as ``kwargs``.

in help(plot) that has just about everything except the new stuff anyway.

Besides, help(plot) is the go-to method that (I at least) use if I want
to look up the usage a kwarg. If it's there, then I can use (say the
marker symbol) in scatter without needing the extensive extra
documentation in help(scatter).

So having help(plot) extra-documented makes plenty of sense for me.

M

> Additionally, we will be adding alias to access the color by name for
> 2.0 final (see https://github.com/matplotlib/matplotlib/pull/7639 )
>
> Tom
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: easily accessing the default color cycle list

tcaswell
Pull requests to improve the documentation are always welcome :)

You seem to have a clear idea of what would be helpful to include in that docstring, could you please add it?

Tom

On Tue, Jan 10, 2017 at 1:38 PM Michael Kaufman <[hidden email]> wrote:
On 1/10/17 1:18 PM, Thomas Caswell wrote:
> It is also documented
> at http://matplotlib.org/2.0.0rc2/users/colors.html which is too verbose
> to put into the docstring of every method (almost all of them) that
> takes in a color-like input.
>

Ok, but we've already got a nice paragraph:

     In addition, you can specify colors in many weird and
     wonderful ways, including full names (``'green'``), hex
     strings (``'#008000'``), RGB or RGBA tuples (``(0,1,0,1)``) or
     grayscale intensities as a string (``'0.8'``).  Of these, the
     string specifications can be used in place of a ``fmt`` group,
     but the tuple forms can be used only as ``kwargs``.

in help(plot) that has just about everything except the new stuff anyway.

Besides, help(plot) is the go-to method that (I at least) use if I want
to look up the usage a kwarg. If it's there, then I can use (say the
marker symbol) in scatter without needing the extensive extra
documentation in help(scatter).

So having help(plot) extra-documented makes plenty of sense for me.

M

> Additionally, we will be adding alias to access the color by name for
> 2.0 final (see https://github.com/matplotlib/matplotlib/pull/7639 )
>
> Tom

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Loading...