reset color cycler?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

reset color cycler?

Neal Becker
Some answers were given here:

https://stackoverflow.com/questions/24193174/reset-color-cycle-in-matplotlib

I prefer the

ax.set_prop_cycler(None)

approach, but I want to reset only the 'color' (I assume this will reset all
cyclers to defaults).  I would have expected something like this to work:

ax.set_prop_cycler('color', None)

but it doesn't.

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

Re: reset color cycler?

Benjamin Root
That is not an available feature in the underlying cycler class. We would need to implement a new feature in cycler first, then add our hooks to it in matplotlib.

On Thu, Jan 11, 2018 at 8:33 AM, Neal Becker <[hidden email]> wrote:
Some answers were given here:

https://stackoverflow.com/questions/24193174/reset-color-cycle-in-matplotlib

I prefer the

ax.set_prop_cycler(None)

approach, but I want to reset only the 'color' (I assume this will reset all
cyclers to defaults).  I would have expected something like this to work:

ax.set_prop_cycler('color', None)

but it doesn't.

_______________________________________________
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
|

Re: reset color cycler?

Saito Kotaro (PSI)
In reply to this post by Neal Becker
Hi Neal,

I’m not sure about your purpose for resetting the colour cycle, but this answer might be helpful.

https://stackoverflow.com/a/47773515/9131000

Best regards,

Kotaro

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

Re: reset color cycler?

Saito Kotaro (PSI)
Backend doesn’t matter in your case. I recommend to apply 'Colors from color cycle’ method in the SO answer.
The idea is that, first, you get a list of colors from your color cycle before making a pdf page. Then you plot your data with color keyword, like plot(x, y, color=color_list_from_colorcycle[i]) with an index number ‘i’ incremented after each plot, save a pdf page, reset the index ‘i’ to zero, repeat the procedure whatever times you want.
It’s not elegant at all but I’m sure it solves the problem.

If first ten colors in your color cycle is enough for you, then ‘CN notation’ method is also applicable. (matplotlib 2 is required for this method)

Best,

Kotaro

> 2018/01/11 19:08、Neal Becker <[hidden email]>のメール:
>
> I'm using PdfPages to produces multiple plots.  At the start of each page I reset the color cycle.
>
> On Thu, Jan 11, 2018 at 12:55 PM Saito Kotaro (PSI) <[hidden email]> wrote:
> Hi Neal,
>
> I’m not sure about your purpose for resetting the colour cycle, but this answer might be helpful.
>
> https://stackoverflow.com/a/47773515/9131000
>
> Best regards,
>
> Kotaro
>

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