我试图在X轴上显示年份,用条形表示的体积,用线形表示的值。谁能看到我要去哪里错了?
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
data1 = pd.DataFrame({'Year' : [2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019],
'Volume' : [32, 35, 33, 36, 38, 39, 40, 42, 49, 47],
'Value' : [40, 41, 46, 44, 43, 42, 42, 45, 48, 52]})
data1[['Year', 'Volume']].plot(kind='bar', width = 0.5, color="navy")
data1['Value'].plot(secondary_y=True, color='orange')
plt.show()