【发布时间】:2021-11-24 13:32:18
【问题描述】:
当通过 custom_data/hovertemplate 范例在 plotly express 中创建自定义悬停卡时,颜色显示在其右侧。例如,此处显示“a=1”右侧的“blue”。如何去除“蓝色”?
import pandas as pd
import plotly.express as px
df = pd.DataFrame(dict(x=["a"], y=[1], color=["blue"], hover=["a=1"]))
fig = px.bar(df, "x", "y", "color", custom_data=["hover"])
fig.update_traces(hovertemplate="%{customdata[0]}")
(colab notebook可以访问here)
【问题讨论】:
标签: python plotly plotly-python plotly-express