Simple question here, I am creating a pie chart in pandas for the value counts of a dataset's regional spread:
df['region'].value_counts().plot.pie
I want to use the colormap "cool" to color this so it matches my other visualizations, is this possible or am I oversimplifying? Do I need to assign a color to each region or can I somehow just add a colormap='cool' somewhere in here? New to visualizations here...
CodePudding user response:
You can pass the argument cmap='cool' to the .pie method. Here's an example:
import matplotlib.pyplot as plt
import pandas as pd
s = pd.Series([1,2,3,4,5])
s.plot.pie(cmap='cool')
plt.show()
CodePudding user response:
use as the "cmap" additional parameter in pie
df['region'].value_counts().plot.pie(cmap=plt.get_cmap('cool'))

