Sas3
Sas3

Reputation: 15

Unrepeated colors in multiple line plots using matplotlib

I have 20 columns to plot using unrepeated colors. I would like to use tab20 color map. How do I use it?

I am finding all the online resources difficult to understand as I am still naive Python user.

Upvotes: 1

Views: 476

Answers (1)

Joe
Joe

Reputation: 12417

In general this is how you can do it:

import matplotlib
cmap = matplotlib.cm.get_cmap(your_cmap) #your_cmap='tab20'
df.plot(cmap=cmap)
plot.show()

Here you can find the references: https://matplotlib.org/examples/color/colormaps_reference.html

Upvotes: 1

Related Questions