Mundane plotting done easy.
Project description
plotEZ
Mundane plotting made easy.
plotez is a Python library that simplifies common matplotlib plotting tasks with an intuitive API. Create complex plots
with minimal boilerplate code.
Features
- Simple API: Create complex plots with just a few lines of code
- Error Bar Plotting: Comprehensive error bar support with enhanced styling options
- Error Band Plotting: Shaded error band support via
plot_errorbandandErrorBandConfig - Dual-Axis Support: Easy creation of dual y-axis or dual x-axis plots
- Multi-Panel Layouts: Flexible subplot arrangements with automatic labeling
- File Integration: Direct plotting from CSV files
- Extensive Customization: Full control over plot appearance via parameter classes
- Type Safety: Complete type hints for better IDE support and type checking (PEP 561 compliant)
- Well Tested: Comprehensive test suite with 85%+ coverage
Installation
From PyPI
pip install plotez
From Source
git clone https://github.com/syedalimohsinbukhari/plotez.git
cd plotez
pip install -e .
Development Installation
pip install -e ".[dev]"
Quick Start
"""Basic plotting example."""
import numpy as np
from plotez import plot_xy
# Generate data
x = np.linspace(0, 10, 100)
y = np.sin(x)
# Create a plot with automatic labeling
plot_xy(x, y, auto_label=True)
Examples
Dual Y-Axis Plot
"""Demonstration of dual-y axis capability."""
import numpy as np
from plotez import plot_xyy
x = np.linspace(0, 10, 100)
y1 = np.sin(x)
y2 = np.exp(-x / 10)
plot_xyy(x, y1, y2,
x_label="Time", y1_label="Sine", y2_label="Exponential",
data_labels=["sin(x)", "exp(-x/10)"], plot_title="Dual Y-Axis Example")
"""Demonstration of dual-y axis capability with custom plot configuration."""
import matplotlib.pyplot as plt
import numpy as np
from plotez import plot_xyy
from plotez.backend import LinePlotConfig
x = np.linspace(0, 10, 50)
y1 = np.sin(x)
y2 = np.exp(-x / 10)
plot_config = LinePlotConfig(linestyle=["--", "-."], color=["red", "cyan"], marker=["o", "s"],
markersize=[10, 10], markeredgecolor=["k", "k"], _extra={"markevery": [3, 5]})
plot_xyy(x, y1, y2,
x_label="Time", y1_label="Sine", y2_label="Exponential", data_labels=["sin(x)", "exp(-x/10)"],
plot_config=plot_config)
Multi-Panel Plots
"""Demonstration of multi-panel layout capability with customizations."""
import numpy as np
from plotez import n_plotter
from plotez.backend import LinePlotConfig, FigureConfig
# Create 2×2 grid
x_data = [np.linspace(0, 10, 100) for _ in range(6)]
y_data = [
np.sin(x_data[0]),
np.cos(x_data[1]),
np.tan(x_data[2] / 5),
x_data[3]**2 / 100,
1 / np.cos(x_data[4]),
x_data[5]
]
line_config = LinePlotConfig(color=["red", "blue", "green", "black", "orange", "magenta"])
fig_config = FigureConfig(figsize=(10, 6))
fig, axs = n_plotter(x_data, y_data,
n_rows=2, n_cols=3, auto_label=True,
plot_config=line_config, figure_config=fig_config)
Error Bar Plots
import numpy as np
from plotez import plot_errorbar
from plotez.backend import ErrorPlotConfig
# Generate sample data with errors
x = np.linspace(0, 10, 20)
x_err = 0.4
y = np.sin(x)
y_err = 0.1 * np.random.rand(len(y))
# Enhanced error bar styling
ep = ErrorPlotConfig(
linestyle=':',
linewidth=2,
color='darkblue',
marker='d',
markersize=6,
capsize=8,
elinewidth=2, # Error bar line width
ecolor='red', # Error bar color (different from line!)
capthick=2 # Error bar cap thickness
)
plot_errorbar(x, y, x_err=x_err, y_err=y_err, errorbar_config=ep)
Error Band Plots
"""Demonstration of error band plotting with custom configurations."""
import numpy as np
from plotez import plot_errorband
from plotez.backend import ErrorBandConfig, LinePlotConfig
rng = np.random.default_rng(1234)
x = np.linspace(0, 10, 50)
y = np.sin(x)
y_low = y - 0.2
y_upp = y + 0.2
error_config = ErrorBandConfig(color="cyan", edgecolor="k", linestyle="--", hatch="\\")
line_config = LinePlotConfig(color="gold", linestyle="--", linewidth=2,
marker="o", markersize=5, markeredgecolor="k")
ax = plot_errorband(x, y, y_low, y_upp,
data_label=r"$\sin(X)$", band_config=error_config, line_config=line_config)
Development
Running Tests
pytest
With Coverage Report
pytest --cov=src/plotez --cov-report=html
Type Checking
mypy src/plotez
Building Documentation
cd docs
make html
Project Status
- Type hints are corrected throughout the codebase
- Test suite implemented (80%+ coverage)
- Documentation structure created
- Development tools configured (pytest, mypy, sphinx)
- PEP 561 compliance (py.typed marker)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License – see LICENSE file for details.
Authors
- Syed Ali Mohsin Bukhari - ali.mohsin@ist.edu.pk
Links
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
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 plotez-0.2.0.tar.gz.
File metadata
- Download URL: plotez-0.2.0.tar.gz
- Upload date:
- Size: 20.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e6b07901258b4f1a85e1f9b04f1ba15162339ac5238abd9c6f69a8d5a761aa8
|
|
| MD5 |
f256b9c12f27d1aa81ddeef17e989d6c
|
|
| BLAKE2b-256 |
97de1baecdb9ab61f3a823373a19a21fd845d497ae1745edcccb7ea30d5586dd
|
File details
Details for the file plotez-0.2.0-py3-none-any.whl.
File metadata
- Download URL: plotez-0.2.0-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e36e8dca4e67ad70ca6d830237855f575051dee9ce9a592683d31d7443f221b7
|
|
| MD5 |
af37ecf629c62d1cc8121f75e7053b42
|
|
| BLAKE2b-256 |
15feae10e572042e02619df40b75f9f025f25ae33c9667e92d744dceeb5756f7
|