用散点图覆盖线图

时间:2020-04-29 14:07:09

标签: python pandas matplotlib linegraph

我试图用散点图覆盖线图。到目前为止,我有以下代码用于线图:

plt.figure()
ax = plt.gca()

df1.plot(kind='line',x='newdate',y='max', color='red', ax=ax, label='Maxima')
df1.plot(kind='line',x='newdate',y='min',ax=ax, label='Minima')

plt.xlabel('Date')
plt.ylabel('Temperature')
plt.title('Lowest and highest temperatures by day of the year (2005 -2015)')

plt.gca().fill_between(range(len(df1['max'])), 
                       df1['max'], df1['min'], 
                       facecolor='blue', 
                       alpha=0.25)

对于散点图,我有一个熊猫数据框,其中有两列,一列包含日期,另一列包含与该日期关联的值。如何将这些值作为数据点添加到上一个折线图中?

0 个答案:

没有答案