如何在绘图表上显示悬停信息?

cna*_*ash 6 python plotly

我想在绘图表上显示悬停信息。这是我最好的猜测,但是在 jupyter notebook 中或当图形导出到 html 并在浏览器中查看时,没有显示悬停文本:

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')
Run Code Online (Sandbox Code Playgroud)

情节版本 4.5.4

有许多 go.Table() 参数看起来可能是相关的,但我没有找到显示任何内容的组合:

  • 悬停信息
  • 悬停信息源
  • 悬停标签
  • 元源
  • 自定义数据
  • 自定义数据源

我一直在看的一些参考资料:

Mar*_*ick 1

这似乎是一个文档错误,悬停当前不适用于表格。您可以查看有关此错误的开放 git 问题: https ://github.com/plotly/plotly.js/issues/5523