Skip to main content

Making Gantt charts in matplotlib

Project description

Granttpy

When you want to make a Gantt chart look nice for a grant or whatever

Example Gantt chart

Installation

You can install directly from this repository via

pip install grantt

As a side-note, we recommend installing with uv using

uv pip install grantt

Example

After grantt is installed, copy the script from here into ex.py and run python ex.py (or python3 depending on your installation).

Basic instructions

Making a Gantt chart is as easy as making different grantt.Elements, the parent class for all the different things on the chart. Type help(grantt.Element) to see the fields for the constructor: most of them should be self-explanatory, but here are a few notes on the more cryptic fields.

  • zorder_delta: how much precedent the element should have when displaying on top of (or behind) other objects
  • level_increment: The chart is generated by starting from the top and moving down. Every time that an element with a nonzero increment is added, the following elements are below it vertically. If you have two elements overlapping vertically, try increasing the level_increment of one.
  • textalignment: takes left, right, or center.
  • Any colors (i.e., color or textcolor) take in any argument that MPL would (e.g., k for black or #FF0000 for red, etc).

grantt.Span

A grantt.Span just spans an amount of time, generally acting as a divider between two vertically adjacent sections. It has a start and end date as well as an adjustable edge height for the prongs on the sides.

grantt.Period

A grantt.Period also spans an amount of time, but acts more as a time period that one might work on a task. These are represented by thicker lines; therefore, you may be interested in changing lw, the linewidth of the element.

grantt.Event

A grantt.Event is a point in time that something happens with no duration---think milestone or deadline. Along with choosing the date of the deadline, you can customize the marker and its markersize (which will need to be done based on the aspect ratio and scaling of the figure).

Defaults

There are several defaults that you can customize using Gantt.set_X, where X is the option.

  • marker: default marker for grantt.Event elements
  • markersize: default markersize for grantt.Event elements
  • linewidth: default linewidth for grantt.Period elements
  • textcolor: default textcolor for all elements
  • span_edge_height: default height of the edge brackets for grantt.Span elements
  • luminance_threshold: the threshold for automatically switching between white and black text in grantt.Period elements based on their color.

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

grantt-0.2.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grantt-0.2.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file grantt-0.2.0.tar.gz.

File metadata

  • Download URL: grantt-0.2.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for grantt-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b61900792fdd9fb7d77c7924247af907de8c76a26a507968c185b807c937ffee
MD5 6313401dda2ac9aaef4f6aaa3e9a3c8d
BLAKE2b-256 dda56ce3e8bf3bd5901b0422e08503cce081f864c4e861ca847499e02a32bd3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for grantt-0.2.0.tar.gz:

Publisher: python-package.yml on dannys4/granttpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file grantt-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: grantt-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for grantt-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 93015e1bfe7ee9fb447f279b4241b7cbe382d559dab0f1b696997b9213329673
MD5 187bb28e27850f063e24fd1cdcb03fee
BLAKE2b-256 a33343f1099755a7eaaff67aab5e7bb4a1cea42a1d65dc0f3606c3dad11b338c

See more details on using hashes here.

Provenance

The following attestation bundles were made for grantt-0.2.0-py3-none-any.whl:

Publisher: python-package.yml on dannys4/granttpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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