Calendar heatmaps from Pandas time series data
Project description
Calplot creates heatmaps from Pandas time series data.
Plot Pandas time series data sampled by day in a heatmap per calendar year, similar to GitHub’s contributions plot, using matplotlib.
With default configuration:
With arguments edgecolor=None
, cmap='YlGn'
:
With arguments yearcolor=black
, cmap='YlGn'
:
With arguments textformat='{:.0f}'
, textfiller='-'
, cmap='YlGn'
:
With arguments dropzero=False
, cmap='YlGn'
:
With arguments linewidth=0
, cmap='YlGn'
:
Usage
See the documentation.
Code to generate the first example:
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)
Installation
To install the latest release via PyPI using pip:
pip install calplot
Changelog
Package calplot is a fork of calmap 0.0.7-dev with the following changes and additions.
Since version 0.1.6 (Dec 2020):
Added argument
textformat
for functioncalplot
andyearplot
to specify the text format string for grid cell text. Defaults to empty string. Note that text plotting is turned off by setting the argument to empty string.Added argument
textfiller
for functioncalplot
andyearplot
to specify the fallback text for grid cell text. Defaults to empty string.Added argument
textcolor
for functioncalplot
andyearplot
to specify the text color for grid cell text. Defaults toblack
.
Since version 0.1.5 (Dec 2020):
Added argument
edgecolor
for functioncalplot
andyearplot
to specify color of seperation lines between months. Defaults togray
. Note that lines can be turned off by setting the argument toNone
without quotes.
Since version 0.1.3 (Aug 2020):
Removed legacy code for compatibility to fix a FutureWarning in
yearplot
. Note thatpandas>=1.1
is now required to install the package.
Since version 0.1.2 (Jan 2020):
Added argument
dropzero
for functioncalplot
andyearplot
to specify whether to not fill a cell with a color for days with a zero value. Defaults toTrue
.
Since version 0.1.1 (Jan 2020):
Renamed function
calendarplot
tocalplot
.Added argument
colorbar
for functioncalplot
to display a colorbar to the right of the heatmap if more than one unique values in plot. Defaults toTrue
.Added argument
figsize
for functioncalplot
. Defaults to a tighter layout automatically adjusted to fit the number of years in plot.Added argument
suptitle
for functioncalplot
. Defaults toNone
.Added argument
yearcolor
for functioncalplot
. Defaults tolightgray
. Note that the default color is in contrast towhitesmoke
, which is the default value forfillcolor
.Added argument
monthlabelha
for functioncalplot
andyearplot
to specify horizontal alignment for month labels. Defaults tocenter
.Changed default colormap
cmap
for functioncalplot
toviridis
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for calplot-0.1.6.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f03f332ca2163b74f2bb9bf3bca5b108d56b172bf4e940260ddb0497958ae3e7 |
|
MD5 | 927d2bb43030b53a785026d1a4b3ea93 |
|
BLAKE2b-256 | bc47e726820f60878e05816e8251a0b20ecd55c2b6a5d76b20313ddf741c6840 |