Skip to main content

epiplot

CI PyPI

Plots for epidemiology and public health research, with good practice built in.

An epidemic curve made with epiplot

Status

Early development (alpha). Ready to try:

  • Epidemic curves: cases over time.
  • Rate maps: rates by region, for one period or as a timeline.

Survival curves are planned.

Install

pip install epiplot

For rate maps, which need GeoPandas, install the extra map libraries too:

pip install "epiplot[maps]"

Requires Python 3.13 or newer. Works in Google Colab, which already includes GeoPandas.

Epidemic curves

import pandas as pd

import epiplot

# One row per case (a "line list").
cases = pd.DataFrame(
    {
        "onset_date": ["2026-03-02", "2026-03-04", "2026-03-10", "2026-03-11", None],
        "origin": ["Local", "Travel", "Local", "Local", "Travel"],
    }
)

ax = epiplot.epicurve(cases, "onset_date", date_type="onset", group_col="origin")
ax.figure.savefig("epicurve.png")

For the counts behind the plot, as a table, use epiplot.count_cases().

Good practice built in:

  • Says what the dates mean. Onset, report, specimen or diagnosis dates tell different stories, so epiplot labels the axis to match, and warns if the date type isn't given.
  • Shows empty periods as zero, so gaps in an outbreak stay visible.
  • Reports cases with missing dates under the plot, instead of silently leaving them out.
  • Shades recent periods that may be incomplete because of reporting delays, if you give it a date.
  • Uses colour-blind-safe colours, with missing groups in grey.
  • Supports ISO weeks (starting Monday) and US CDC weeks (starting Sunday).

Rate maps

A timeline of rate maps made with epiplot, using made-up districts

# regions: a GeoPandas table of region shapes, with an "area_code" column.
# data: one row per region, with "cases" and "population" columns.
ax = epiplot.rate_map(
    regions, data, "area_code", cases_col="cases", population_col="population"
)

# One small map per period, all sharing one colour scale.
figure = epiplot.rate_map_timeline(
    regions,
    data_by_month,
    "area_code",
    "month",
    cases_col="cases",
    population_col="population",
)

For the rates behind the maps, with exact 95% confidence intervals, use epiplot.calculate_rates(). Rates you have already calculated, such as age-standardised rates, can be mapped with rate_col and rate_label.

Good practice built in:

  • Maps rates, not raw counts, since counts mostly show where people live. Rates are clearly labelled as crude rates.
  • Hides regions with fewer than 5 cases, whose rates are unreliable and could identify individuals.
  • Shows "no data" differently from zero, so gaps in reporting aren't mistaken for no disease.
  • Uses a single-colour scale starting at zero, with colour bands as an option.
  • Timelines share one colour scale, so the same shade means the same rate in every period.

Fuller examples are in the examples folder.

License

BSD 3-Clause. See LICENSE.

Metadata

Release files for epiplot 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for epiplot 0.3.0
File Size Uploaded Provenance Actions
epiplot-0.3.0.tar.gz 23.7 kB With provenance Details for epiplot-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for epiplot 0.3.0
File Interpreter ABI Platform Actions
epiplot-0.3.0-py3-none-any.whl Python 3 none any Details for epiplot-0.3.0-py3-none-any.whl

Total release size: 41.7 kB

Release files / epiplot-0.3.0.tar.gz

Download URL epiplot-0.3.0.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2e733ecfe5db139fe99bf9f525de14cf9cf5a4c0ed4ee3efc98363a45d5de4ff
BLAKE2b-256 checksum
How to use checksums
4236295b068d27a9e7148669f553950fb2e343de6a835cc822e03b93f4810b72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / epiplot-0.3.0-py3-none-any.whl

Download URL epiplot-0.3.0-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14bd0148265c4af2a8f03e7b8cf9ccd5e841cee4b5ff7f415345a7c44acf3250
BLAKE2b-256 checksum
How to use checksums
fe5d892991d54b78ffbd0904c201854b9956c16fa8340566f11dbeda3971f180
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Security for epiplot 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for epiplot-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page