|
3 | 3 | Library: plotly |
4 | 4 | """ |
5 | 5 |
|
6 | | -import pandas as pd |
7 | 6 | import plotly.graph_objects as go |
8 | 7 |
|
9 | 8 |
|
10 | 9 | # 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] |
12 | 12 |
|
13 | 13 | # Create plot |
14 | 14 | 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})) |
18 | 16 |
|
19 | 17 | # Layout |
20 | 18 | fig.update_layout( |
21 | | - title={"text": "Basic Line Plot", "font": {"size": 20}}, |
| 19 | + title={"text": "Basic Line Plot", "font": {"size": 36}}, |
22 | 20 | xaxis_title="Time", |
23 | 21 | yaxis_title="Value", |
24 | 22 | 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}, |
29 | 27 | ) |
30 | 28 |
|
31 | 29 | # Save |
|
0 commit comments