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

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.7
File Size Uploaded Provenance Actions
hedgehogs-0.0.7.tar.gz 877.4 kB Without provenance Details for hedgehogs-0.0.7.tar.gz

Built distribution (wheel)

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

Total release size: 955.4 kB

Release files / hedgehogs-0.0.7.tar.gz

Download URL hedgehogs-0.0.7.tar.gz
Size 877.4 kB
Tags Source
SHA-256 checksum
How to use checksums
16c7d60fe37c2223478f82e66306bf871b863a9f29a3b4f9dc9e9a0010d98ec1
BLAKE2b-256 checksum
How to use checksums
d3b20d309df5a705ba05e3de6993472fac9fd41efae773087097ef017162515b
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.7-py3-none-any.whl

Download URL hedgehogs-0.0.7-py3-none-any.whl
Size 78.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
42cb4dc33f79fc652ddd42e455c77f5577094cb5052568beb237a0bccdf1e4c0
BLAKE2b-256 checksum
How to use checksums
cbf087b4c4e96e995553bcef3bb68bfe81114c5672bf0518f4e35feb2d106dfb
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.7

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