Creating Calendar Heatmaps

Hi,

On my way to developing an application, I had a really hard time with making an interactive Calendar Heatmap (kinda like the one on Github and Gitlab), and thanks to this post on Plotly’s community forum I was able to make it.

Using the code provided and adding my own I managed to fix some bugs with pandas weekly data and make it into a package for anyone to use.

(This project is open-source and available on my Github)

I’ve also written an article on medium describing exatcly how to use it, check it out

Here’s what some samples look like

fig = calplot(
    dummy_df,
    x="ds",
    y="value",
    gap=0
)
fig.show()

fig = calplot(
    dummy_df,
    x="ds",
    y="value",
    dark_theme=True
)
fig.show()

fig = calplot(
    dummy_df,
    x="ds",
    y="value",
    dark_theme=True,
    years_title=True,
    colorscale="purples",
    gap=0,
    name="Data",
    month_lines_width=3, 
    month_lines_color="#fff"
)
fig.show()

6 Likes

Welcome to the community @brunorosilva
Thank you for sharing this app with us. What I especially like about this is also the capability you give the user to create custom color scales easily:

fig = calplot(
    dummy_df,
    x="ds",
    y="value",
    gap=0,
    colorscale=[(0.00, "white"),   (0.33, "#999"),
                (0.33, "#999"), (0.66, "#444"),
                (0.66, "#444"),  (1.00, "#000")]
)
2 Likes

Excited to check this out @brunorosilva, looks awesome and congrats on working through the challenges you had.

1 Like