Skip to main content

A Python package for creating pyramid plots using Matplotlib.

Project description

Pyramid Plot

A Python package for creating pyramid plots using Matplotlib.

Installation

pip install pyramidplot

Usage

Using DataFrame

import pandas as pd
import matplotlib.pyplot as plt
from pyramidplot import pyramidplot

# Sample data
levels = ["Producers", "Primary Consumers", "Secondary Consumers", "Tertiary Consumers"]
values = [800, 400, 200, 150]

data = pd.DataFrame({
    "Level": levels,
    "Value": values
})

# Create plot
fig, ax = plt.subplots(figsize=(8, 6))
pyramidplot(
    data, 
    var_levels="Level", 
    var_values="Value", 
    ax=ax, 
    show_trend=True, 
    edgecolor='none',
    label_color='black',
    trend_color='gray'
)

plt.show()

Pyramid Plot Demo

Using Lists

import matplotlib.pyplot as plt
from pyramidplot import pyramidplot

levels = ["Producers", "Primary Consumers", "Secondary Consumers", "Tertiary Consumers"]
values = [800, 400, 200, 150]

fig, ax = plt.subplots(figsize=(8, 6))
pyramidplot(
    levels, 
    values, 
    ax=ax, 
    show_trend=True,
    edgecolor='none',
    label_color='black',
    trend_color='gray'
)
plt.show()

Features

  • Custom Levels and Values: Takes a DataFrame or two lists (levels, values).
  • Matplotlib Polygons: Uses Polygon patches to draw the pyramid levels (trapezoids).
  • Colormap Support: Allows specifying a colormap for level coloring.
  • Labels: Options to label levels and values.
  • Label Color: Option to specify label color or use the level color (default).
  • Trend Overlay: Option to show arrows and percentage change between levels (centered with labels, smaller size, padded).
  • Trend Color: Option to specify color for trend arrows and text (default 'gray').
  • Edge Customization: Option to customize or remove polygon edges using edgecolor.

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

pyramidplot-0.1.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

pyramidplot-0.1.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file pyramidplot-0.1.1.tar.gz.

File metadata

  • Download URL: pyramidplot-0.1.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyramidplot-0.1.1.tar.gz
Algorithm Hash digest
SHA256 86102fa15411b2d71e03e18599c46ab5fbcf26932826be4531ab9b936b569e8e
MD5 bfc657ba03598cadd9d13430d583dcee
BLAKE2b-256 4e35ffcc03ba99126f3010c5917f3f873f6346971aa739880393969a2de97d57

See more details on using hashes here.

File details

Details for the file pyramidplot-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyramidplot-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyramidplot-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 16cb087207c6b3f89bd568f23d32f62a80c3f348836c5fc8a93c0036acde8907
MD5 382cfd66ce8559836d79ffc4a77f4917
BLAKE2b-256 0428ff93842dbe0b27751f9da34dc146a23cabe6906944c308ef349c7212d38b

See more details on using hashes here.

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