How to remove Pandas Series name from plot?

Viewed 521
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

3 Answers

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('')

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)

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
Related