如何解决通过在其上添加“点”或某种标记来改进绘图线图Python
我有一个数据框df,在其中创建了一个折线图。我希望通过折线图中的点来监视它。
样本数据集:
Size Date POD
0.027289 11/1/2020 SJ
0.013563 11/1/2020 SJ
0.058498 11/1/2020 SJ
0.281953 11/1/2020 SJ
0.479725 11/1/2020 SJ
0.007358 11/1/2020 SJ
0.075818 11/1/2020 SJ
0.069744 11/1/2020 SJ
这就是我在做的
import plotly.express as px
import plotly.graph_objects as go
fig = px.line(df1,x = "Date",y = "Size",color = "POD",title = "POD Growth in US",labels =
{"Size": "Size in TB"})
fig.update_layout(
font_family="Arial",font_color="black",title_font_family="Arial",title_font_color="black",legend_title_font_color="black"
)
fig.update_xaxes(title_font_family="Arial")
fig.update_layout(
title={
'text': "POD Growth in US",'y':0.9,'x':0.5,'xanchor': 'center','yanchor': 'top'})
fig.show()
期望的结果是有点
解决方法
使用mode='lines+markers'
。我不确定它是否可以像我通常使用的那样使用line
方法和px
fig = go.Figure()
fig.add_trace(go.Scatter(
x = df1["Date"],y = df1["Size"],mode='lines+markers'))
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。