Python Forum
Rename labels of a bar chart Matplotlib
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rename labels of a bar chart Matplotlib
#2
You need to set the index as these fields as shown below:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

df_interested = pd.read_csv(r'C:\Users\mirza\Downloads\Topic_Survey_Assignment.csv',index_col="Unnamed: 0")
interested = df_interested.sort_values(['Very interested'], ascending = False, axis = 0, inplace = True)
df_interested.plot(kind = 'bar', figsize = (20,8), width = 0.8, color=['#5cb85c', '#5bc0de', '#d9534f'])
plt.title('Pourcentage of respondents interest in Data Science Areas', size = 16)
plt.legend(prop={"size":14})
 
sns.despine()
sns.despine(top=True, right=True, left=True, bottom=False)
 
plt.xlabel("X Label")
plt.ylabel("Y Label")
ax = plt.gca()
# ax.axes.xaxis.set_visible(False)
# ax.axes.yaxis.set_visible(False)
plt.grid(True)
 
plt.show()
To know about data visualization and pandas, have a look at these articles
Reply


Messages In This Thread
RE: Rename labels of a bar chart Matplotlib - by hussainmujtaba - Jul-01-2020, 01:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question I’m trying to create a Power BI Matplotlib quadrant chart and I’m a little stumped. Nidwolff 1 478 Mar-04-2024, 06:07 AM
Last Post: Danishhafeez
  Matplotlib bar chart ollarch 0 1,406 Mar-04-2020, 10:45 AM
Last Post: ollarch
  Spacing pie chart colours evenly in matplotlib? Giovanni_diJacopo 1 3,298 Jul-12-2019, 12:31 PM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020