我试图在同一张图上绘制两年的数据,包含在不同的数据框中。图片如下。A plot of the current separate years of data
#Sets the size of the figure in the notebook
%pylab inline
pylab.rcParams['figure.figsize'] = (25, 15)
#Plots the figure, configures settings about the plot
plt.plot(df['date_time'],df['WTMP','degC'])
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%m/%Y'))
plt.gca().xaxis.set_major_locator(mdates.MonthLocator())
#fontsize of the tick labels
plt.rc('xtick', labelsize=15)
plt.rc('ytick', labelsize = 15)
#Size of ticks
plt.tick_params(direction='out', length=10, width=2,)
#X and Y labels
plt.xlabel('Time',fontsize=18)
plt.ylabel('WTMP (degC)',fontsize=18)
plt.show()
#Second Plot
plt.plot(df2['date_time'],df2['WTMP','degC'],color = 'red')
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%m/%Y'))
plt.gca().xaxis.set_major_locator(mdates.MonthLocator())
plt.show()
如何在同一个图形上以完全相同的方式显示这两个绘图?我试过使用一个透视表,如下所示
piv = pd.pivot_table(result, index=['month'],columns=['year'], values=
['WTMP'])
这是可行的,但它是顺利的,我没有得到同样的日常决议如上所述
目前没有回答
相关问题 更多 >
编程相关推荐