In the middle of the desert you can say anything you want

23 May 2023

More matplotlib color fun with cycler package

There’s cycler, a package:

It returns cycles of dicts, finite or infinite:

from cycler import cycler

# list of colors
pal = sns.color_palette("Paired")

# `cycler` is a finite cycle, cycler() is an infinite
cols = iter(cycler(color=pal)())

# every time you need a color
my_color = next(cols)
Nel mezzo del deserto posso dire tutto quello che voglio.