import plotly.graph_objects as go
import pandas as pd
import numpy as np
df = pd.DataFrame({
"x": pd.date_range("1-jan-2021", periods=10),
"Positive": np.random.uniform(1, 5, 10),
"Negative": np.random.uniform(-5, -3, 10),})
go.Figure(
[go.Bar(x=df["x"], y=df[t], meta=df[t].abs(), name=t, hovertemplate="%{meta:.2f}") for t in ["Positive", "Negative"]]
).update_layout(hovermode="x unified")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.