我下面的这段代码运行得很好。但是,我想使用 plotly 来创建相同的图形。我如何转换此代码,以便它使用 plotly 来绘制图形?
> dict1 = {'Date': ['2022-12-02', '2022-12-16', '2023-01-15'], 'Impressions': [20, 21, 19]}
dict2 = {'Date': ['2022-08-02', '2022-09-16', '2023-02-20'], 'Impressions': [18, 51, 48]}
df1 = pd.DataFrame(dict1)
df2 = pd.DataFrame(dict2)
df1['Date'] = pd.to_datetime(df1['Date'])
df2['Date'] = pd.to_datetime(df2['Date'])
fig, ax = plt.subplots()
ax2 = ax.twinx()
df1.plot(x="Date", y="Impressions", ax=ax)
df2.plot(x="Date", y="Impressions", ax=ax2, ls="--")
plt.show()