Reputation: 899
data.groupby('parental level of education')['gender'].count().plot(kind='pie', autopct='%.1f%%', title='Population Composition',fontsize=10)
The following code plots a pie chart which has the name written 'gender' on the plot. I want to remove that. How do I do that? Pie Chart Image
Upvotes: 2
Views: 1078
Reputation: 1507
The series name goes into the ylabel
argument of the plot()
. This can be used (as suggested in another answer here) when calling the plot()
function.
For your question, this goes something like
data.groupby('parental level of education')['gender'].count().plot(
kind='pie',
autopct='%.1f%%',
title='Population Composition',
fontsize=10,
ylabel='') ## Here is the change :P
Upvotes: 0
Reputation: 41
By setting the y-axis label with empty string.
ax=data.groupby('parental level of education')['gender'].count().plot(kind='pie', autopct='%.1f%%', title='Population Composition',fontsize=10)
ax.set_ylabel('')
Upvotes: 2
Reputation: 1
It seems to be automatically passing gender as a kwarg. Quite a roundabout way but this works.
s = data.groupby('parental level of education')['gender'].count()
s.name = ""
s.plot(kind='pie', autopct='%.1f%%', title='Population Composition',fontsize=10)
Upvotes: 0