Python Calendar Heatmaps

Pubblicato il: 29 settembre 2020
sul canale di: Ryan Noonan
3,783
61

In this python tutorial, we will go over how to create calendar heatmaps using calmap and calplot.

Calendar heatmaps can be a good way to visualize data trends and patterns by day for a year or several years and provide an overview of the data.

Code Examples on GitHub: https://github.com/groundhogday321/py...

calmap and calplot are similar. calplot is a fork of calmap with the addition of arguments colorbar, dropzero, figsize, suptitle and yearcolor. There might be other slight differences.

In the examples in this tutorial, we are using temperature and precipitation and we want to see which days had the highest temperatures and most precipitation as indicated by the colormap. Some colormaps have a color scheme that might be counter intuitive (i.e.-lighter colors for higher numbers and so on). This can be fixed by reversing the colormap (_r after colormap name) or choosing a different colormap.

Custom colorbars can be created and added with matplotlib. See example below:

import matplotlib as mpl
fig, ax = plt.subplots(figsize=(6,1))
fig.subplots_adjust(bottom=0.5)
cmap = mpl.cm.coolwarm
norm = mpl.colors.Normalize(vmin=temps.min(), vmax=temps.max())
fig.colorbar(mpl.cm.ScalarMappable(norm=norm, cmap=cmap),
cax=ax, orientation='horizontal', label='Some Units');


In questa pagina del sito puoi guardare il video online Python Calendar Heatmaps della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Ryan Noonan 29 settembre 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 3,783 volte e gli è piaciuto 61 spettatori. Buona visione!