Skip to main content
Hedgehogs

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.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hedgehogs 0.0.4
File Size Uploaded Provenance Actions
hedgehogs-0.0.4.tar.gz 470.6 kB Without provenance Details for hedgehogs-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hedgehogs 0.0.4
File Interpreter ABI Platform Actions
hedgehogs-0.0.4-py3-none-any.whl Python 3 none any Details for hedgehogs-0.0.4-py3-none-any.whl

Total release size: 543.0 kB

Release files / hedgehogs-0.0.4.tar.gz

Download URL hedgehogs-0.0.4.tar.gz
Size 470.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ec1e903f4d3c11043dc2a892af46bdda054d97677722703bc3107717975bf418
BLAKE2b-256 checksum
How to use checksums
91e8e926e1332aac5da95f64419f2afb906b236db462090e9f131c78ffcad349
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.4-py3-none-any.whl

Download URL hedgehogs-0.0.4-py3-none-any.whl
Size 72.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
886f080cc549a21fc600951643da3f949991d3fd867cd1a69cf296b817bc2927
BLAKE2b-256 checksum
How to use checksums
31723e354f6c1a33d19dc5106aec5fec2d71c42978469df6b6147da19fb908b5
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.4

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page