use matplotlib color map for color cycle

For Matplotlib 2.2, using the cycler module will do the trick, without the need to convert to Hex values.

import cycler

n = 100
color = pyplot.cm.viridis(np.linspace(0, 1,n))
mpl.rcParams['axes.prop_cycle'] = cycler.cycler('color', color)

Leave a Comment