Hedgehogs
Scientific figures and reports for Python.
Documentation · Installation · API
Hedgehogs prepares Matplotlib figures and presents tables, progress and status messages in notebooks and terminals.
- Journal-oriented figure presets for single- and double-column layouts.
- Colour-blind-friendly palettes, such as Okabe–Ito, Paul Tol and IBM schemes.
- Consistent figure dimensions across local and remote notebook display and export.
- Clear tables, status messages and progress bars in notebooks, terminals and redirected logs.
Installation
Requires Python 3.10+.
pip install hedgehogs
Usage Example
Figures
Choose the journal dimensions first, then draw with Matplotlib. The style supplies typography, line widths, marker sizes and outlines; finishing measures the complete figure and adjusts supported legend and bar-label placement.
import numpy as np
import matplotlib.pyplot as plt
import hedgehogs as hdg
fig_x, fig_y = hdg.figsize(name="science", column="single")
palette = hdg.get_palette("okabe-ito")
hdg.set_style(figure_size=(fig_x, fig_y), palette="okabe-ito")
x = np.linspace(0, 1, 25)
y = 2 * x + 0.1 * np.sin(20 * x)
fitted = np.polyval(np.polyfit(x, y, 1), x)
fig, ax = plt.subplots(figsize=(fig_x, fig_y))
ax.scatter(x, y, color=palette["blue"], label="Data")
ax.plot(x, fitted, color=palette["black"], label="Linear fit")
ax.set(xlabel="x", ylabel="y")
ax.legend()
hdg.plots.save("linear_fit.pdf", bbox_inches=None)
hdg.plots.show()
figsize() returns width and height in inches for science, nature, ieee or aps, with single or double columns. Presets provide starting dimensions; check the target journal's author instructions. Use an extensionless path with formats=("pdf", "png") for multiple outputs. Matplotlib arguments and artist properties remain editable.
Tree diagrams and pairplots also return editable Matplotlib objects. Keep text readable at the final document width; select fewer variables or split crowded figures before reducing font size.
Tables
Display the same table in a notebook or terminal, then export its formatted values to CSV and LaTeX.
table = hdg.Table("Model comparison", columns=["Case", "RMSE"], formatters={"RMSE": ".3f"})
table.add_row("baseline", 0.0412)
table.add_row("model", 0.0184)
table.show()
table.to_csv("errors.csv")
table.to_latex("errors.tex", caption="Model errors", label="tab:errors")
Table.from_dataframe() accepts existing pandas and Polars DataFrames. The LaTeX output requires booktabs. Tables or accompanying data provide precise values; figures communicate patterns and comparisons.
Progress
Wrap an iterable with Progress to report progress in notebooks, terminals and redirected logs.
import time
for step in hdg.Progress(range(20), desc="Processing"):
time.sleep(0.05)
For manually advanced work, Progress supports update(), metric reporting through set() and a context manager. See the progress reference.
Terminal output
hdg.echo("Reading data", tone="info")
hdg.echo("Run completed", tone="success")
hdg.rule("Summary")
Terminal output includes colour where supported. Redirected output remains plain; NO_COLOR and TERM=dumb disable colour.
Documentation and tutorials
Read the documentation site for guides and API references, or the repository roadmap for developer documentation. Runnable tutorials cover plots, tables, and CLI output.
Existing Onsaemiro code can replace its import with import hedgehogs as hdg. Wrap iterable work with hdg.Progress(iterable, ...) and use the standard time.sleep() for delays.
Metadata
Release files for hedgehogs 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hedgehogs-0.0.6.tar.gz | 829.7 kB | Without provenance | Details for hedgehogs-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hedgehogs-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for hedgehogs-0.0.6-py3-none-any.whl |
Total release size: 905.9 kB
Release files / hedgehogs-0.0.6.tar.gz
| Download URL | hedgehogs-0.0.6.tar.gz |
|---|---|
| Size | 829.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d46bd3feac36c1e55fa56a7b6b0129028aa21122f51689d25ab936c471503330
|
|
BLAKE2b-256 checksum How to use checksums |
c9d705b1aa03d9ea8e3d6d351f83c32cca3e63df948af3dd96b345dc079a188f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / hedgehogs-0.0.6-py3-none-any.whl
| Download URL | hedgehogs-0.0.6-py3-none-any.whl |
|---|---|
| Size | 76.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8f871f209ea8b0933c352830c6d0cadc0b866dc333ada3d2bb6b6e5b8925776
|
|
BLAKE2b-256 checksum How to use checksums |
f9678d74f3f871e3e6a6073b98d5df7bb87d2c54a6421ad6acfe7f0b1dd37cef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for hedgehogs 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.