diff --git a/plots/plotly/scatter/line-basic/default.py b/plots/plotly/scatter/line-basic/default.py index a00d8cf2db..dff4e3245a 100644 --- a/plots/plotly/scatter/line-basic/default.py +++ b/plots/plotly/scatter/line-basic/default.py @@ -3,26 +3,29 @@ Library: plotly """ +import pandas as pd import plotly.graph_objects as go # Data -time = [1, 2, 3, 4, 5, 6, 7] -value = [10, 15, 13, 18, 22, 19, 25] +data = pd.DataFrame({"time": [1, 2, 3, 4, 5, 6, 7], "value": [10, 15, 13, 18, 22, 19, 25]}) # Create plot fig = go.Figure() -fig.add_trace(go.Scatter(x=time, y=value, mode="lines", line={"color": "#306998", "width": 2}, name="Value")) +fig.add_trace( + go.Scatter(x=data["time"], y=data["value"], mode="lines", line={"color": "#306998", "width": 2}, name="Value") +) # Layout fig.update_layout( - title={"text": "Basic Line Plot", "font": {"size": 20}, "x": 0.5}, + title={"text": "Basic Line Plot", "font": {"size": 20}}, xaxis_title="Time", yaxis_title="Value", - xaxis={"tickfont": {"size": 16}, "title_font": {"size": 20}, "gridcolor": "rgba(0,0,0,0.1)"}, - yaxis={"tickfont": {"size": 16}, "title_font": {"size": 20}, "gridcolor": "rgba(0,0,0,0.1)"}, template="plotly_white", - showlegend=False, + xaxis={"title_font": {"size": 20}, "tickfont": {"size": 16}, "showgrid": True, "gridcolor": "rgba(0,0,0,0.1)"}, + yaxis={"title_font": {"size": 20}, "tickfont": {"size": 16}, "showgrid": True, "gridcolor": "rgba(0,0,0,0.1)"}, + legend={"font": {"size": 16}}, + margin={"l": 80, "r": 40, "t": 80, "b": 60}, ) # Save