Skip to main content

Hedgehogs

Hedgehogs logo and wordmark, with orange and blue accents

Scientific figures and reports for Python.

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, including Okabe–Ito and Paul Tol 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+. Install from a source checkout:

git clone https://github.com/PentagonToy/Hedgehogs.git
cd Hedgehogs
python -m pip install -e .

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

Use the documentation roadmap for guides, API references and 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.1

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.1
File Size Uploaded
hedgehogs-0.0.1.tar.gz 339.0 kB Details

Built distribution (wheel)

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

Total release size: 389.0 kB

Release files / hedgehogs-0.0.1.tar.gz

Download URL hedgehogs-0.0.1.tar.gz
Size 339.0 kB
Tags Source
SHA-256 checksum
How to use checksums
73a3ffba8f03a59fc13348567b1820d2afd5844d21d626b2c419e07243edd5e6
BLAKE2b-256 checksum
How to use checksums
f70da1365808cc003d1e8fec1545024aad404989df0e9befac4b0aebc521ac8b
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.1-py3-none-any.whl

Download URL hedgehogs-0.0.1-py3-none-any.whl
Size 50.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f224360ee99c45a671d9d574aad4b7a38297a3fcc44c357c7fa295e173b919e0
BLAKE2b-256 checksum
How to use checksums
d498e46e6be9832dedca3bf30cc043e7d7b752a9280de69ee66cc1f5977da35f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

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