Skip to content

Commit f03faec

Browse files
feat(plotly): improve line-basic implementation
- Remove unnecessary pandas import (use simple lists) - Disable legend for single series (per quality criteria) - Increase font sizes for better readability at 4800x2700px - Increase line width from 2 to 3 for better visibility - Adjust margins for proper layout
1 parent 13e600c commit f03faec

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

plots/plotly/scatter/line-basic/default.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,27 @@
33
Library: plotly
44
"""
55

6-
import pandas as pd
76
import plotly.graph_objects as go
87

98

109
# Data
11-
data = pd.DataFrame({"time": [1, 2, 3, 4, 5, 6, 7], "value": [10, 15, 13, 18, 22, 19, 25]})
10+
time = [1, 2, 3, 4, 5, 6, 7]
11+
value = [10, 15, 13, 18, 22, 19, 25]
1212

1313
# Create plot
1414
fig = go.Figure()
15-
fig.add_trace(
16-
go.Scatter(x=data["time"], y=data["value"], mode="lines", line={"color": "#306998", "width": 2}, name="Value")
17-
)
15+
fig.add_trace(go.Scatter(x=time, y=value, mode="lines", line={"color": "#306998", "width": 3}))
1816

1917
# Layout
2018
fig.update_layout(
21-
title={"text": "Basic Line Plot", "font": {"size": 20}},
19+
title={"text": "Basic Line Plot", "font": {"size": 36}},
2220
xaxis_title="Time",
2321
yaxis_title="Value",
2422
template="plotly_white",
25-
xaxis={"title_font": {"size": 20}, "tickfont": {"size": 16}, "showgrid": True, "gridcolor": "rgba(0,0,0,0.1)"},
26-
yaxis={"title_font": {"size": 20}, "tickfont": {"size": 16}, "showgrid": True, "gridcolor": "rgba(0,0,0,0.1)"},
27-
legend={"font": {"size": 16}},
28-
margin={"l": 80, "r": 40, "t": 80, "b": 60},
23+
showlegend=False,
24+
xaxis={"title_font": {"size": 28}, "tickfont": {"size": 22}, "showgrid": True, "gridcolor": "rgba(0,0,0,0.1)"},
25+
yaxis={"title_font": {"size": 28}, "tickfont": {"size": 22}, "showgrid": True, "gridcolor": "rgba(0,0,0,0.1)"},
26+
margin={"l": 80, "r": 40, "t": 100, "b": 80},
2927
)
3028

3129
# Save

0 commit comments

Comments
 (0)