I am using a combination of subplot (one for each month) and heatmap (go.heatmap) to create a monthly calendar of my property occupancy. I am using the following code.
fig.add_trace(go.Heatmap(
x=x_weeknumber_split[i],
y=y_dow_list_split[i],
z=z_split[i],
text=text_split[i],
hoverinfo='text',
xgap=3, # this
ygap=3, # and this is for grid-like appearance
showscale=False,
zmin=0,
zmax=3,
colorscale=colorscale
),
row=indx + 1,
col=i + 1
)
I am then setting the yaxis using the following code:
fig.update_yaxes(showline=False,
showgrid=False,
zeroline=False,
rangemode='tozero',
tickmode='array',
ticktext=['Mon', 'Tue', 'Wed', 'Thu', 'Fri',
'Sat', 'Sun'],
tickvals=[0, 1, 2, 3, 4, 5, 6],
ticks='',
row=indx + 1,
col=i + 1)
This works fine for complete months. But when the starting date is say the 28th of the month and the first month has very few entries (i.e. 3) the heatmap looks contorted …
X values = [‘2020ww48’, ‘2020ww48’, ‘2020ww49’]
Y values = [5, 6, 0]
Z values = [‘1’, ‘1’, ‘1’]
I suspect I am making some error with the yaxis setup. Any help appreciated