通过添加 'dots' 或某种标记来改进 Plotly 线图 (Python)
Improve Plotly Line Graph by adding 'dots' or some sort of marker to it (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
方法和像素,因为我通常会使用
fig = go.Figure()
fig.add_trace(go.Scatter(
x = df1["Date"], y = df1["Size"], mode='lines+markers'))
我有一个数据框 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
方法和像素,因为我通常会使用
fig = go.Figure()
fig.add_trace(go.Scatter(
x = df1["Date"], y = df1["Size"], mode='lines+markers'))