Closed ghhar98 closed 2 years ago
Hey @ghhar98 ,
The spacing between two years is a bit sketchy at times and I'll work on a definite fix, but as a quick fix for your problem, try to use the space_between_plots
parameter, it's default is 0.08 as this worked ok(ish) on the data I tested.
Here are some examples on how to use it with sample data:
with space_between_plots = 0.08
(default)
with space_between_plots = 0.12
with space_between_plots = 0.25
Thanks for your response, it's now working. Maybe off subject, but I was also wondering if it currently was possible to add a legend to the plot for the color scale? I can't find an option for it
Yes, this is possible. It's not a native option in the library, but you can do it using update_traces
with the heatmap selector updating the showscale property to None
or to True
, as the example below.
fig = calplot(
dummy_df,
x="ds",
y="value",
years_title=True,
space_between_plots=0.12,
)
fig.update_traces(showscale=True, selector=dict(type="heatmap"))
And of course you can add customization to the scale
fig.update_traces(colorbar=dict(
title="Events per Cell",
thicknessmode="pixels", thickness=10,
lenmode="pixels", len=300,
yanchor="middle",
ticks="outside",
ticksuffix=" events",
dtick=2
), showscale = True, selector=dict(type='heatmap'))
@ghhar98 sorry to tag you, but did my response solve your issue?
Yes, thank you!
Hi, I tried using this package, which I find really useful. My problem is that when I'm making my calendar heatmap, the year label interact with the heatmap above :
The code I'm using to generate the plot is
fig = calplot( df_day_count, x="date", y="count", name="Number of events", years_title=True )
While my df looks like this :
Thanks.