【发布时间】:2020-07-26 12:51:10
【问题描述】:
我正在从数据框生成条形图,我想删除 Y 轴标签并将它们显示在条形上方。我怎样才能做到这一点?
到目前为止,这是我的代码:
ax = rounded_df.plot(kind='bar',
figsize=(20, 8),
width=0.8,
color=['#5cb85c', '#5bc0de', '#d9534f']
)
plt.xticks(fontsize=14)
plt.yticks(fontsize=14)
plt.legend(fontsize=14)
plt.title('Percentage of Respodents\' Interest in Data Science Areas', fontsize=16)
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.spines['left'].set_visible(False)
这是我的图表: Graph
这是数据:
Very_interested Somewhat_interested Not_interested
Data_Analysis/Statistics 72.95 21.36 3.31
Machine_Learning 75.59 19.88 2.69
Data_Visualization 60.01 32.87 4.57
Big_Data_(Spark/Hadoop) 59.65 32.65 5.69
Deep_Learning 56.56 34.48 6.09
Data_Journalism 19.21 48.41 27.32
【问题讨论】:
标签: python matplotlib bar-chart