I would like to show different heatmaps in different figure traces (Each heatmap with it's own colorscale, range etc.)
Therefore, I fill figure traces with individual heatmaps (go.Heatmap):
import numpy as np
import plotly.graph_objects as go
from plotly.subplots import make_subplots
fig = make_subplots(
rows=3, cols=1,
shared_xaxes=True,
)
fig.add_trace(go.Heatmap(
z=[[15, 30, 40, -11, None],],
x=['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
y=['Morning'],
coloraxis="coloraxis1"),
row=1, col=1)
fig.add_trace(go.Heatmap(
z=[[30, 60, 1, -10, 20],],
x=['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
y=[ 'Afternoon'],
name='Afternoon',
coloraxis="coloraxis2"),
row=2, col=1)
fig.add_trace(go.Heatmap(
z=[[None, None, None, None, None],],
x=['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
y=['Evening'],
name='Evening',
coloraxis="coloraxis3"),
row=3, col=1)
fig.update_layout(
height=400,
coloraxis1={
"colorbar_x": 1.0,
"colorbar_y": 0.85,
"colorbar_len": 0.4,
"colorscale": 'plasma',
},
coloraxis2={
"colorbar_x": 1.0,
"colorbar_y": 0.52,
"colorbar_len": 0.4,
"colorscale": 'viridis',
},
coloraxis3={
"colorbar_x": 1.0,
"colorbar_y": 0.18,
"colorbar_len": 0.4,
"colorscale": 'delta',
}
)
fig.show()
Problem
In case there is no data in one of the heatmaps (as shown the 'Evening' heatmap above) no yaxis label and no corresponding heatmaps are rendered.
I am looking for a way to show these labels also in case there are only NaNs
The only workaround I came up with was to fill dummy data into the heatmap. Is there another way to render the empty heatmap labels?