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

时间:2020-06-23 16:14:07

标签: python plotly

我想在一个可绘制的表格上显示悬停信息。这是我的最佳猜测,但是在jupyter笔记本中或将图形导出为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')

plotly版本4.5.4

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

  • hoverinfo
  • hoverinfosrc
  • hoverlabel
  • metasrc
  • customdata
  • customdatasrc

我一直在看的一些参考文献:

1 个答案:

答案 0 :(得分:1)

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