'How to embed an image in to a cell of a Plotly go table?

I've seen here that you can use DashTable to allow Markdown in a plotly table like so,

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')
    ),
])

is there any way to do this with a basic plotly.graph_objects table? i.e. go.Table

example table code:


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) ','![png_test](https://octodex.github.com/images/minion.png)', '[yahoo.com](yahoo.com)', '[community.plot.ly](community.plot.ly)',]]))
                     ])

fig.show()


Solution 1:[1]

You can replace the stackoverflow markdown in your cells with html tags for hyperlinks: <a href="...">link name</a>.

However, I am not sure if you can embed images as using the <img src="..."> tag doesn't seem to work and is interpreted as text instead of html.

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()

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1