如何固定悬停模板在Plotly Express中的位置

发布于 2025-02-13 04:51:33 字数 520 浏览 1 评论 0原文

在下面的示例代码中,将有一个悬停表,鼠标悬停在图片上。这真的很酷:

import plotly.express as px

df = px.data.gapminder().query("continent=='Oceania'")

fig = px.line(df, x="year", y="lifeExp", color="country")
fig.update_layout(hovermode="x unified")
fig.show()

“简单x统一悬停表”

,但我的问题是: 有什么方法可以修复此悬停表的位置(例如,在右下角)而不是鼠标位置? 当您将鼠标悬停在图片上时,右下底角上的悬停表值就像默认模式一样更新?

In the example code below, there will be a hover table where the mouse hovers on the picture. which is really cool:

import plotly.express as px

df = px.data.gapminder().query("continent=='Oceania'")

fig = px.line(df, x="year", y="lifeExp", color="country")
fig.update_layout(hovermode="x unified")
fig.show()

simple x unified hover table

but my question is:
is there any way to fix position of this hover table (at right-bottom corner for example) instead of mouse position?
and when you hover the mouse on the picture, the hover table values on right-bottom corner updates just like the default mode?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文