我想在绘图表上显示悬停信息。 这是我最好的猜测,但是当图形导出为 html 并在浏览器中查看时,不会在 jupyter 笔记本中显示悬停文本:
import plotly.graph_objects as go
hover_text = [['hover a', 'hover b', 'hover c'],
['hover d', 'hover e', 'hover f']]
fig = go.Figure(data=[go.Table(
cells={'values': [['a', 'b', 'c'],
['d', 'e', 'f']]},
hoverinfo='text',
meta={'text': hover_text}
)])
fig.show()
fig.write_html('test.html')
剧情版本 4.5.4
有很多去。Table(( 参数看起来可能相关,但我还没有找到显示任何内容的组合:
- 悬停信息
- Hoverinfosrc
- 悬停标签
- 元
- 梅塔斯克
- 自定义数据
- customdatasrc
我一直在看的一些参考资料:
- https://plotly.github.io/plotly.py-docs/generated/plotly.graph_objects.Table.html
- https://plotly.com/python/table/
- https://plotly.com/python/hover-text-and-formatting/#hover-labels
- https://plotly.com/python/reference/#table
这似乎是一个文档错误,悬停目前不适用于表格。您可以查看有关此错误的未解决的 git 问题: https://github.com/plotly/plotly.js/issues/5523