plotting_utils
Elegant wrappers around matplotlib and seaborn, for scientific plotting that stays consistent across figures.
Installation
pip install ac-plotting-ut
Note on the package name. This project was previously published on PyPI as
plotting_utils. From v0.2.0 it is distributed asac-plotting-ut. The import name is unchanged —import plotting_utils as plukeeps working. The oldplotting_utilsdistribution is no longer maintained.
Quick Start
import matplotlib.pyplot as plt
import pandas as pd
import plotting_utils as plu
# Journal-style rcParams
plu.set_rcParams()
df = pd.DataFrame({
'x': [1, 2, 3, 4],
'y': [2, 4, 5, 8],
'group': ['a', 'a', 'b', 'b'],
})
fig, ax = plt.subplots(figsize=(6, 4))
plu.scatter(df, 'x', 'y', by='group', ax=ax)
plu.format_ax(ax, xlabel='X values', ylabel='Y values', reduced_spines=True)
plu.save_best_pdf_quality(fig, figsize=(6, 4), path='.', name='my_plot.pdf')
Every plotting function takes a pd.DataFrame plus column names, draws onto an
ax you provide, and returns that ax — so they compose freely with plain
matplotlib.
API
🎨 Colors
| Function | Purpose |
|---|---|
create_palette() |
Build a {category: color} mapping from a DataFrame column |
ten_godisnot, darjeeling, fantastic_fox |
Ready-made qualitative palettes |
📊 Plots
| Function | Purpose |
|---|---|
scatter() |
Scatter, coloured/sized by categorical or continuous columns |
dist() |
Kernel density distributions, optionally split by group |
counts_plot() |
Category frequencies |
bar(), box(), strip(), violin() |
Categorical comparisons, optionally grouped by by |
bb_plot() |
Stacked composition (crosstab) plot |
plot_heatmap() |
Heatmap with optional row/column clustering |
dotplot() |
Dotplot with size and colour encodings |
volcano() |
Volcano plot with automatic label placement |
stem_plot(), rank_plot() |
Ranked-value displays |
🛠 Axis decoration and utilities
| Function | Purpose |
|---|---|
set_rcParams() |
Apply journal-style matplotlib defaults |
format_ax() |
Labels, ticks, rotation, log scale, reduced spines |
add_legend(), add_cbar() |
Legends and colorbars from a palette or array |
add_wilcox() |
Statistical annotations via statannotations |
order_from_index() |
Ordering helper for matrix plots |
save_best_pdf_quality() |
High-DPI PDF export |
Timer, run_command, make_folder, update_params |
Small helpers |
Requirements
Python 3.10+. Dependencies (numpy, pandas, scipy, matplotlib, seaborn,
scikit-learn, joblib, pillow, statannotations, textalloc) are installed
automatically.
Tested on Linux and macOS against Python 3.10, 3.11 and 3.12.
Development
git clone https://github.com/andrecossa5/plotting_utils.git
cd plotting_utils
pip install -e ".[test]"
pytest
Release History
0.2.1
- Fixed
bar()silently ignoringcategorical_cmap: an unreachable branch meant an explicit palette was never applied and bars rendered in seaborn's default colour bar()no longer needs an explicitcategorical_cmap=Nonewhenbyis unset- Replaced seaborn's deprecated
palette-without-hueusage, removed in seaborn 0.14 - Added tests asserting rendered colours, not just that a call succeeds
0.2.0
- Renamed the PyPI distribution to
ac-plotting-ut; import name unchanged - Modern
pyproject.tomlpackaging (hatchling);setup.pyremoved - Declared previously-missing dependencies:
numpy,pandas,scipy,pillow - Requires Python 3.10+; verified against numpy 2.5, pandas 3.0, matplotlib 3.11, seaborn 0.13
- Added a test suite (85 tests) and CI across Linux/macOS on Python 3.10–3.12
- Automated PyPI releases via Trusted Publishing
- Fixed
volcano()raisingValueErrorwhen called with its own defaultylim - Fixed
volcano()andrank_plot()label placement failing on non-integer indices - Fixed
rank_plot()passing an invalid positional argument toax.scatter - Fixed
dotplotandrank_plotbeing absent from__all__ violin()no longer needs an explicitcategorical_cmap=Nonewhenbyis unset
0.1.5
- Last release under the
plotting_utilsdistribution name
0.1.4 (2025-09-11)
- Enhanced README with comprehensive documentation
- Added proper package metadata (long_description, author, classifiers)
- Improved PyPI package presentation
0.1.3
- Previous stable release
License
MIT — see LICENSE.
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 ac_plotting_ut-0.2.1.tar.gz.
File metadata
- Download URL: ac_plotting_ut-0.2.1.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed1da3a9044d58b634f71d4112d8d12c0a6dedc51d6eaebab9f3dc9bb252abae
|
|
| MD5 |
5ac93d84a699aeacc20da661a0707f06
|
|
| BLAKE2b-256 |
ef6985672d15f4442f16b5b3d42fcd5c162c76e65c469c57812d99b2c7d7b6eb
|
Provenance
The following attestation bundles were made for ac_plotting_ut-0.2.1.tar.gz:
Publisher:
release.yaml on andrecossa5/plotting_utils
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ac_plotting_ut-0.2.1.tar.gz -
Subject digest:
ed1da3a9044d58b634f71d4112d8d12c0a6dedc51d6eaebab9f3dc9bb252abae - Sigstore transparency entry: 2343859712
- Sigstore integration time:
-
Permalink:
andrecossa5/plotting_utils@3c53b3754aff3ffafb88fb9652377612a47f2e2c -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/andrecossa5
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@3c53b3754aff3ffafb88fb9652377612a47f2e2c -
Trigger Event:
push
-
Statement type:
File details
Details for the file ac_plotting_ut-0.2.1-py3-none-any.whl.
File metadata
- Download URL: ac_plotting_ut-0.2.1-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24a293e099374987171a31ffa3d7c610f741148c9722dc6926c8a7343f8dfed1
|
|
| MD5 |
07e1b62ed3d19c7d04f8ea8a25bbb981
|
|
| BLAKE2b-256 |
44fc820b08a8015be1028aeec93ae5249a4e394987c4fdad85a7c98663992c88
|
Provenance
The following attestation bundles were made for ac_plotting_ut-0.2.1-py3-none-any.whl:
Publisher:
release.yaml on andrecossa5/plotting_utils
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ac_plotting_ut-0.2.1-py3-none-any.whl -
Subject digest:
24a293e099374987171a31ffa3d7c610f741148c9722dc6926c8a7343f8dfed1 - Sigstore transparency entry: 2343859737
- Sigstore integration time:
-
Permalink:
andrecossa5/plotting_utils@3c53b3754aff3ffafb88fb9652377612a47f2e2c -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/andrecossa5
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@3c53b3754aff3ffafb88fb9652377612a47f2e2c -
Trigger Event:
push
-
Statement type: