Hi, does anyone knows why this happens? Seens that my frist and my last point are connected …
this is the code i’m using:
import pandas as pd
import plotly.graph_objects as go
import plotly.express as px
from plotly.subplots import make_subplots
df = pd.read_csv(‘data.csv’, index_col=0, parse_dates=True)
def plot_var_prev(dff):
fig = make_subplots(specs=[[{"secondary_y": True}]])
fig.add_trace(
go.Scatter(x=dff.index,
y=dff['mag_vento'].values,
name="Magnitude"),
secondary_y=False,
)
fig.add_trace(
go.Scatter(x=dff.index,
y=dff['direcao_vento'].values,
name="Direção"),
secondary_y=True,
)
fig.update_xaxes(title_text="<b>Data</b>")
fig.update_layout(hovermode="x", hoverlabel=dict(font_size=16, font_family="Poppins"))
fig.update_layout(plot_bgcolor='rgba(0, 0, 0, 0)', paper_bgcolor='rgba(0, 0, 0, 0)',)
fig.update_layout(
legend=dict(orientation="v"),
yaxis=dict(
title=dict(text='<b>Magnitude do vento [m/s]</b>'),
side="left",
type='linear'
),
yaxis2=dict(
title=dict(text="<b>Direção do vento [°]</b>"),
side="right",
type='linear',
overlaying="y",
tickmode="sync",
rangemode='tozero'
),
)
return fig
The data and nootebook are avaiable here …