Skip to main content

Simple matplotlib and PGFPlots plotting with consistent, publication-ready styling

Project description

hmbp

A simple matplotlib wrapper with consistent, publication-ready styling.

Installation

pip install hmbp

Style

  • Font: Helvetica
  • Colormap: RdPu (primary), PiYG (secondary/diverging)
  • 400 DPI output
  • Consistent sizing: title 15pt, labels 14pt, ticks 13pt, legend 12pt

Usage

import hmbp

fig, ax = hmbp.new_figure()
hmbp.line_plot(y_values, x_values, label="Model A")
hmbp.set_labels("Title", "X Label", "Y Label")
hmbp.save("output.png")

Available Functions

Function Description
line_plot Line with optional fill and smoothing
multi_line_plot Multiple lines on same axes with smoothing
scatter_plot Scatter with optional color mapping
histogram Color-mapped histogram
histogram_overlay Overlaid histograms for comparison
bar_plot Vertical/horizontal bars
box_plot Box plot distributions
violin_plot Violin plot distributions
heatmap 2D heatmap with colorbar
line_plot_with_error Line with shaded error region
confusion_matrix Annotated confusion matrix
roc_curve ROC curve with AUC
precision_recall_curve PR curve with AP
residual_plot Regression residuals
learning_curve Train/val learning curves
metric_comparison Horizontal bar comparison
volcano_plot Volcano plot for differential analysis

Smoothing

Line plots support EMA smoothing for noisy data (e.g., training curves):

# smooth=0.9 means 90% weight on previous value (heavy smoothing)
hmbp.quick.line(noisy_loss, smooth=0.9, path="smoothed.png")
hmbp.quick.lines([y1, y2], labels=["A", "B"], smooth=0.8, path="comparison.png")

Helpers

  • new_figure(figsize) - Create figure and axes
  • set_labels(title, xlabel, ylabel) - Apply labels
  • save(path, fig, close) - Save with auto-legend

Quick API

Single-call functions that create, label, and save in one step:

import hmbp

hmbp.quick.histogram(data, title="Scores", xlabel="Value", path="hist.png")
hmbp.quick.bar(values, labels, title="Comparison", ylabel="F1", path="bars.png")
hmbp.quick.confusion_matrix(cm, class_names=["A", "B"], path="cm.png")

Available: hmbp.quick.line, hmbp.quick.lines, hmbp.quick.scatter, hmbp.quick.histogram, hmbp.quick.histogram_overlay, hmbp.quick.bar, hmbp.quick.heatmap, hmbp.quick.confusion_matrix, hmbp.quick.roc, hmbp.quick.volcano, hmbp.quick.violin

PGFPlots Output

Generate LaTeX figures using PGFPlots for direct inclusion in papers:

import hmbp.pgfplots as pgf

# Step-by-step
pgf.new_figure()
pgf.line_plot(y, x=x, label="Data", marker="*")
pgf.set_labels(title="Results", xlabel="Time", ylabel="Value")
pgf.save("figure.tex")  # Creates .tex and .pdf

# Quick API
pgf.quick_bar(values, labels, title="Comparison", path="bars.tex")
pgf.quick_histogram(data, title="Distribution", path="hist.tex")

Features:

  • Outputs both .tex and compiled .pdf files
  • Helvetica font, clean axis styling, y-major grids
  • Supports line_plot, multi_line_plot, bar_plot, histogram
  • Log scale via new_figure(ymode='log')

Requires a LaTeX distribution with lualatex or pdflatex.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hmbp-0.3.2.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hmbp-0.3.2-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file hmbp-0.3.2.tar.gz.

File metadata

  • Download URL: hmbp-0.3.2.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hmbp-0.3.2.tar.gz
Algorithm Hash digest
SHA256 98974bd23538465fefca922fa81a00cba45900b791270879db2629ae2a9faa0e
MD5 8faf8cb424dadb7e057a1a16f1a232a6
BLAKE2b-256 c34a6b613fad26ab92376565c744b9c2a8b5b2974a0245a24d5213c83f1399c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for hmbp-0.3.2.tar.gz:

Publisher: pypi.yml on hmblair/hmbp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hmbp-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: hmbp-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hmbp-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 204c78d54f2e6cf687531e3f5133c97e7394a9ff866bc646070f6fb2eaadb51b
MD5 5e9722c0a5de1fa05488a4ed2eec7bd1
BLAKE2b-256 1b52ce12dd2066dd2a30790c80040eb647be014a9b629e7526763b5570c8b790

See more details on using hashes here.

Provenance

The following attestation bundles were made for hmbp-0.3.2-py3-none-any.whl:

Publisher: pypi.yml on hmblair/hmbp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page