我是python新手,如果这听起来像个愚蠢的问题,我很抱歉。
我试图改变一个绘图中x轴的标题,从我读到的,如果你使用子绘图,你需要使用set_xlabel('X Axis')
命令,但由于某些原因,这对我不起作用。在
plot=plt.subplots();
dftemp=dftemp.set_index('Date2');
plot=dftemp['yield_bruto_percent'].plot(kind='bar',color="lightgray",title=dftemp['paper_name'][1][::-1]+' ינוציח-ימינפ גוריד ',figsize=(8,4),legend=True)
plot=dftemp['dirug_mnpik_psagot'].plot(secondary_y=True,legend=True);
plot=dftemp['final_score'].plot(secondary_y=True,legend=True);
plot=dftemp['dirug_manpik_hitzoni'].plot(secondary_y=True,legend=True,rot=45);
plot.set_xlabel('X Axis')
运行此代码时,标签不会更改,标签显示为变量的名称,即数据集中的索引。 这就是我得到的信息
^{pr2}$如有任何建议,我们将不胜感激。在
https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.set_xlabel.html函数是axis类的成员。在
您可以从子批次中获取axes类的对象,如下所示
然后设置xlabel如下
^{pr2}$相关问题 更多 >
编程相关推荐