Add example using error bars, for example to display high and low and average temperatures. Can also be used for custom confidence intervals.
import pandas as pd
import plotly.express as px
import numpy as np
chart_df = daily_weather.copy()
chart_df.reset_index(inplace=True)
# Calculate differences for error bars
chart_df['err_high'] = chart_df['high'] - chart_df['avg']
chart_df['err_low'] = chart_df['avg'] - chart_df['low']
# Create scatter plot with asymmetric error bars
fig = px.scatter(chart_df, x='date', y='avg',
error_y="err_high",
error_y_minus="err_low",
title='Daily Temperature Average with Low-High Range')
fig.update_layout(
xaxis_title='Date',
yaxis_title='Temperature'
)
fig.show()
Add example using error bars, for example to display high and low and average temperatures. Can also be used for custom confidence intervals.