plot dataframe kind= line with axis 标签
plot dataframe kind= line with axis labels
我已经而且我得到了让我对当时的数据感到满意的答案。但现在我正在尝试使用 kind=line
绘制数据框,以更好地了解我的价值观的评估。所以我正在使用这些 pandas 方法,它们对 kind=line
和 kind=bar
的工作方式不同,但不提供轴的标签。所以我的数据框:
name Homework_note Class_note Behavior_note
Alice Ji 7 6 6
Eleonora LI 2 5 4
Mike The 6 5 3
Helen Wo 5 3 5
我使用的脚本:
df=pd.read_csv(os.path.join(path,'class_notes.csv'), sep='\t|,', engine='python')
df.columns=['name', 'Homework_note', 'Class_note', 'Behavior_note']
ax=df.plot(kind='line', x='name', color=['red','blue', 'green'], figsize=(400,100))
ax.set_xlabel("Names", fontsize=56)
ax.set_ylabel("Notes", fontsize=56)
ax.set_title("Notes evaluation", fontsize=79)
plt.legend(loc=2,prop={'size':60})
plt.savefig(os.path.join(path,'notes_names.png'), bbox_inches='tight', dpi=100)
我还可以添加什么来在轴(x 和 y)上放置标签?我更喜欢使用这些 pandas 方法,因为我发现它们更适合使用数据框,但是我还没有找到在使用这种类型的绘图时放置标签的方法 line
.
标签将显示为较小的 figsize
(in inches!). For the the legend, take a look here
我已经kind=line
绘制数据框,以更好地了解我的价值观的评估。所以我正在使用这些 pandas 方法,它们对 kind=line
和 kind=bar
的工作方式不同,但不提供轴的标签。所以我的数据框:
name Homework_note Class_note Behavior_note
Alice Ji 7 6 6
Eleonora LI 2 5 4
Mike The 6 5 3
Helen Wo 5 3 5
我使用的脚本:
df=pd.read_csv(os.path.join(path,'class_notes.csv'), sep='\t|,', engine='python')
df.columns=['name', 'Homework_note', 'Class_note', 'Behavior_note']
ax=df.plot(kind='line', x='name', color=['red','blue', 'green'], figsize=(400,100))
ax.set_xlabel("Names", fontsize=56)
ax.set_ylabel("Notes", fontsize=56)
ax.set_title("Notes evaluation", fontsize=79)
plt.legend(loc=2,prop={'size':60})
plt.savefig(os.path.join(path,'notes_names.png'), bbox_inches='tight', dpi=100)
我还可以添加什么来在轴(x 和 y)上放置标签?我更喜欢使用这些 pandas 方法,因为我发现它们更适合使用数据框,但是我还没有找到在使用这种类型的绘图时放置标签的方法 line
.
标签将显示为较小的 figsize
(in inches!). For the the legend, take a look here