[Matplotlib-users] reset color cycler?

Saito Kotaro (PSI) kotaro.saito at psi.ch
Thu Jan 11 17:51:50 EST 2018


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 <ndbecker2 at gmail.com>のメール:
> 
> 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) <kotaro.saito at psi.ch> 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
> 



More information about the Matplotlib-users mailing list