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()
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
Polygonpatches 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
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
pyramidplot-0.1.0.tar.gz
(4.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyramidplot-0.1.0.tar.gz.
File metadata
- Download URL: pyramidplot-0.1.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ac9b1de5f5bb657db19b19b33ed02099a5b12890b63c11a4a6719fdb750a751
|
|
| MD5 |
6b59885d9e3c02ed658fc30b7c418684
|
|
| BLAKE2b-256 |
d9942a936dce1abd05b0ddc9969269693701f7d57dfc04cec668d132ee5b50e0
|
File details
Details for the file pyramidplot-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyramidplot-0.1.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
803896844ff90d0c664f0098099b5722aa460ac6ccb0340337503a58350f3ac5
|
|
| MD5 |
bd2c7bd11d51a7a7cf9abe02f749dd8c
|
|
| BLAKE2b-256 |
78a64b75004fa2027e593e4d2859d09397ad126fd71f77569e0d3aa7ce6a1286
|