我见过这样的here,你可以使用DashTable在一个绘制表中允许Markdown,
app.layout = Div([
DataTable(
columns=[
dict(name='id', id='id', type='text'),
dict(name='link', id='link', type='text', presentation='markdown'),
],
data=df.to_dict('records')
),
])有没有办法用一个基本的plotly.graph_objects表来做到这一点呢?即go.Table
示例表代码:
import plotly.graph_objects as go
fig = go.Figure(data=[go.Table(header=dict(values=['score', 'image_or_url']),
cells=dict(values=[[100, 90, 80, 90],['[www.google.com](www.google.com) ','', '[yahoo.com](yahoo.com)', '[community.plot.ly](community.plot.ly)',]]))
])
fig.show()发布于 2021-06-13 06:17:51
您可以使用超链接的html标记替换单元格中的stackoverflow标记:<a href="...">link name</a>。
但是,我不确定是否可以嵌入图像,因为使用<img src="...">标记似乎不起作用,并且被解释为文本而不是hmtl。
import plotly.graph_objects as go
fig = go.Figure(data=[go.Table(header=dict(values=['score', 'image_or_url']),
cells=dict(values=[[100, 90, 80, 90],[
'<a href="https://www.google.com/">www.google.com</a>',
'<img src="https://purepng.com/public/uploads/large/purepng.com-earthearthplanetglobethird-planet-from-the-sun-1411526987553hrjje.png">',
'<a href="https://www.yahoo.com/">www.yahoo.com</a>',
'<a href="https://community.plotly.com/">community.plotly.ly</a>' ,]]))
])
fig.show()

https://stackoverflow.com/questions/67948365
复制相似问题