/calplot

Calendar heatmaps from Pandas time series data.

Primary LanguagePythonMIT LicenseMIT

Calendar heatmaps from Pandas time series data

Build status Code quality Maintainability rating License PyPI version Downloads

Calplot creates heatmaps from Pandas time series data.

Plot Pandas time series data sampled by day in a heatmap per calendar year using matplotlib.

Installation

To install the latest release via PyPI using pip:

pip install calplot

Changelog

Package calplot was started as a fork of calmap with the addition of new arguments for easier customization.

See CHANGES.rst for changelog.

Usage

See API documentation.

Examples

The following examples are run in a Jupyter notebook.

import calplot
import numpy as np; np.random.seed(sum(map(ord, 'calplot')))
import pandas as pd
all_days = pd.date_range('1/1/2019', periods=730, freq='D')
days = np.random.choice(all_days, 500)
events = pd.Series(np.random.randn(len(days)), index=days)
calplot.calplot(events)

Example calendar heatmap with default configuration

all_days = pd.date_range('1/1/2019', periods=360, freq='D')
days = np.random.choice(all_days, 500)
events = pd.Series(np.random.randn(len(days)), index=days)
calplot.calplot(events, edgecolor=None, cmap='YlGn')

Example calendar heatmap with edgecolor set to None

calplot.calplot(events, yearlabel_kws={'color': 'black'}, cmap='YlGn')

Example calendar heatmap with yearcolor set to black

calplot.calplot(events, textformat='{:.0f}', textfiller='-', cmap='YlGn')

Example calendar heatmap with textformat and textfiller set

calplot.calplot(events, colorbar=False, cmap='YlGn')

Example calendar heatmap with colorbar set to False

calplot.calplot(events, suptitle='Random data from standard normal distribution', cmap='YlGn')

Example calendar heatmap with suptitle set

calplot.calplot(events, linewidth=0, cmap='YlGn')

Example calendar heatmap with linewidth set to 0