I need to display a numpy.ndarray type image in a plotly subplot. It can display the image normally by the code:
fig.add_trace(go.Image(z=img), row=1, col=2)
fig.show()
However, when I want to transfer the plotly figure to Dash by the following code, the image in plotly subplot cannot display normally.
app = dash.Dash()
app.layout = html.Div([
dcc.Graph(figure=fig,
style={
'height': '900px',
'width': '100%'
}),
],
style={
'display': 'inline'
})
app.run_server(debug=True)
Just wonder why and how to solve this issue.
I have tried the base64 to encode a png, but I want to know how to display ndarray image directly in Dash.