【发布时间】:2021-11-22 14:55:53
【问题描述】:
我无法在我正在处理的 r markdown 文档中绘制图表(使用 python 和 plotly)。使用下面的代码,我得到了以不同状态打印的五个数字,例如
- 第一个是没有任何水平线,
- 第二个有第一条水平线,
- 第三个图有第二条水平线
- 第四个具有更正的轴名称,并且
- 最后一个打印是正确的(与
fig.show()相关联)。
有没有办法在最后一行代码之前“静音”输出?也许这是与网状有关的问题?
谢谢!
# plotting the bar chart
fig = px.bar(df2122, x="DateYear", y="kg", template="plotly_white")
fig.add_hline(y=169117.6839, annotation_text="Monthly average 2019/20", annotation_position="top right")
fig.add_hline(y=75584.48002, annotation_text="Monthly average 2020/21", annotation_position="top right")
fig.update_layout(xaxis_title="Date", yaxis_title="kg")
# showing the plot
fig.show()
【问题讨论】:
标签: python r plotly r-markdown reticulate