如何在流光中显示绘图
Posted
技术标签:
【中文标题】如何在流光中显示绘图【英文标题】:how to dislay plot in streamlit 【发布时间】:2021-05-11 01:15:20 【问题描述】:我正在使用 streamlit 进行可视化。我想绘制这样的图形 使用 jupyter notebook 中的这段代码
pred_uc = results.get_forecast(steps=100)
pred_ci = pred_uc.conf_int()
ax = y.plot(label='observed', figsize=(14, 7))
pred_uc.predicted_mean.plot(ax=ax, label='Forecast')
ax.fill_between(pred_ci.index,
pred_ci.iloc[:, 0],
pred_ci.iloc[:, 1], color='k', alpha=.25)
ax.set_xlabel('Month')
ax.set_ylabel('Harga USD')
plt.legend()
plt.show()
我应该写什么来显示如上图所示的情节?在我尝试使用之前 `
st.line_chart(forecast)
是的,它没有用。
请给我一个解决方案或参考!谢谢!
`
【问题讨论】:
【参考方案1】:也许你可以试试这样的代码
st.pyplot(fig=plt)
您可以查看 streamlit 文档或其组件,我相信您会在那里找到更多信息。您还可以从博客和社区获得帮助
https://docs.streamlit.io/en/stable/api.html#display-charts
【讨论】:
以上是关于如何在流光中显示绘图的主要内容,如果未能解决你的问题,请参考以下文章