Hello, I have a figure with three subplots, where the third is overlay of the first and second. First subplot is created by go.Image, second by go.Heatmap. For some reason they have switched y axis, but the overlay is correct.
- Does go.Image or go.Heatmap invert the figure in y?
- How is it possible that the overlay is correct?
By px.imshow-ing both pictures, they are in correct orientation (the same as go.Image image and their overlay is shown).
test_merge = images_merged[0]
test_mask = masks[0]
fig = make_subplots(cols=3, rows=1, row_heights=[1])
# Independent pictures
fig = fig.add_trace(go.Image(z=test_merge*500, ), col=1, row=1, )
fig = fig.add_trace(
go.Heatmap(
z=test_mask,
opacity=1,
colorscale=['#000000'] + px.colors.qualitative.Alphabet * 40,
showscale=False
# coloraxis='coloraxis1' # Specify a custom color axis for this trace
),
col=2,
row=1
)
# Overlay
fig = fig.add_trace(go.Image(z=test_merge*500), col=3, row=1)
fig = fig.add_trace(
go.Heatmap(
z=test_mask,
opacity=0.5,
colorscale=['#000000'] + px.colors.qualitative.Alphabet * 40,
showscale=False
# coloraxis='coloraxis2' # Specify a custom color axis for this trace
),
col=3,
row=1,
)
# Update the color axes to hide the colorscale bar
fig = fig.update_layout(coloraxis1=dict(showscale=False))
fig = fig.update_layout(coloraxis2=dict(showscale=False))
fig = fig.update_layout(height=400)
# fig = fig.update_layout(yaxis=dict(autorange="reversed"))
fig.show()
Thanks a lot!