Ale*_*lla 5 html css python plotly
有没有办法将自定义 CSS 添加到 Plotly 下拉按钮?我有以下几个:
...
updatemenus=[
dict(buttons=[
dict(
args=["type", "bar"],
label="Bar Chart",
method="restyle",
),
dict(
args=["type", "scatter"],
label="Line Chart",
method="restyle",
)
]
, direction="down"),
...
Run Code Online (Sandbox Code Playgroud)
但是,当使用主题为“plotly_dark”的图形时,它们悬停时的样子是这样的:

我看到属性 bgcolor、bordercolor、borderwidth...但没有看到有关悬停样式的信息。有人能够让它发挥作用吗?
谢谢
小智 1
你应该使用
font = dict(color='#000000')
Run Code Online (Sandbox Code Playgroud)
例如,
...
updatemenus=[
dict(buttons=[
dict(
args=["type", "bar"],
label="Bar Chart",
method="restyle",
),
dict(
args=["type", "scatter"],
label="Line Chart",
method="restyle",
)
],
direction="down",
font = dict(color='#000000'),
),
...
Run Code Online (Sandbox Code Playgroud)