Python Calendar Heatmaps

Опубликовано: 29 Сентябрь 2020
на канале: 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');


На этой странице сайта вы можете посмотреть видео онлайн Python Calendar Heatmaps длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Ryan Noonan 29 Сентябрь 2020, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 3,783 раз и оно понравилось 61 зрителям. Приятного просмотра!