Skip to main content

A small library for creating pretty heatmaps of daily data.

Project description

July

July

A small library for creating pretty heatmaps of daily data.

Features

  • Get rid of the eternal matplotlib tweaking every time you want to plot data in proper calendar format.
  • Generate GitHub activity overview-like heatmaps of your daily data.
  • Automatic handling of missing dates in input date range.
  • July does not rely only pandas (though it accepts it). Only numpy arrays and native Python data structures are used internally.
  • Accepted date formats: datetime.datetime, datetime.date, str, pd.DatetimeIndex

Install

$ pip install july

Usage

import numpy as np
import matplotlib.pyplot as plt
import july
from july.utils import date_range

dates = date_range("2020-01-01", "2020-12-31")
data = np.random.randint(0, 14, len(dates))
# GitHub Activity like plot (for someone with consistently random work patterns).
july.heatmap(dates, data, title='Github Activity', cmap="github")

GitHub heatmap

# Here, 'osl_df' is a pandas df. 
july.heatmap(osl_df.date, osl_df.temp, cmap="golden", colorbar=True, title="Average temperatures: Oslo , Norway")

Golden heatmap

# More exhaustive example using useless, but pretty colours.
july.heatmap(dates=dates, 
             data=data, 
             cmap='Pastel1',
             month_grid=True, 
             horizontal=True,
             value_label=False,
             date_label=False,
             weekday_label=True,
             month_label=True, 
             year_label=True,
             colorbar=False,
             fontfamily="monospace",
             fontsize=12,
             title=None,
             titlesize='large',
             dpi=100)

Pastel heatmap

# Month plot with dates.
july.month_plot(dates, data, month=5, date_label=True, ax=axes[0])
# Month plot with values.
july.month_plot(dates, data, month=5, value_label=True, ax=axes[1])

Month plot

# Calendar plot. 
july.calendar_plot(dates, data)

Calendar plot

Why "July"?

Main reason: All the obvious names like calplot, calmap, and calendarplot were all already taken by similar packages. This had me looking for a new name that wouldn't get easily mixed up with the other packages.

The reasoning was roughly as follows:

  • Heatmap + monthHot monthJuly :sparkles:

Also, as a summer loving person stuck in the Northern hemisphere, July is my favourite month by a light year.

Release notes

  • v0.1.0: Working build but with minimal documentation.
  • v0.1.1: Fix relative image link in readme.
  • v0.1.2: Remove unnecessary argument from rcmod to be compatible with matplotlib versions earlier than v3.4.x.
  • v0.1.3: Fix week number labelling bug in month_plot() and calendar_plot()

TODO:

  • Fix slight misalignment of plot and cbar when date_grid and colorbar are used in conjunction.
  • Document everything...
  • Add type hints.
  • Add automatic date handling for strings of more types than just YYYY-MM-DD.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

july-0.1.3.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

july-0.1.3-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file july-0.1.3.tar.gz.

File metadata

  • Download URL: july-0.1.3.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.0

File hashes

Hashes for july-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d315c249210a7f608e27d2077eecbebe90bf6627a0faae934da6c416652ca423
MD5 ffa51548e3e035d20b706f580b178724
BLAKE2b-256 ae8cd8e28b4a74eeb0bcae2bbbd2c7559b84ec23e21cfb822fd060cc514c6ec3

See more details on using hashes here.

File details

Details for the file july-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: july-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.0

File hashes

Hashes for july-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f934a407cdc328830344adb1fb140c34bada34e27da5e069f80a2617d1d1d915
MD5 0db327c4aac8f5e7ca3f384256ddc19d
BLAKE2b-256 3f0e420372c1576d3e60833d19fcddce4694366cd14d3526df1e8a79ad8dfddd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page