Skip to main content

AxisBlueprint

PyPI - Version PyPI - Python Version License: MIT GitHub

AxisBlueprint is a lightweight Python toolbox for interactively designing multi-panel scientific figure layouts. Built with Tkinter, it provides a drag-and-drop GUI for arranging axis boxes on a grid, then exports Matplotlib code or renders the layout directly.

Installation

pip install axisblueprint

For FigureFromLayout and generated Matplotlib previews, install the optional plotting dependency:

pip install "axisblueprint[plot]"

Requirements

  • Python 3.8+
  • Tkinter (usually included with Python; on Ubuntu/Debian: sudo apt install python3-tk)
  • Matplotlib (optional, for [plot] extra)

Quick Start

In a Jupyter Notebook (with Tkinter event loop enabled):

%gui tk
from axisblueprint import BlueprintBuilder
BlueprintBuilder()

Or from the command line:

axisblueprint

Features

  • Interactive Layout Design — Create, duplicate, and remove axis boxes on an A4 canvas with a half-centimeter grid overlay.
  • Move & Resize Modes — Drag boxes to reposition them, or resize from the top-left corner.
  • Snap-to-Grid — Optimize your layout by snapping boxes to the nearest half-centimeter.
  • Save, Save As & Load — Save overwrites the current file; Save As writes to a new location; Load opens any .json layout.
  • Default Templates — Save your current layout as the startup default (including canvas size and margins), loaded automatically on next launch.
  • Settings Window — Configure default canvas size, margins, grid spacing, and templates directory via File → Settings.
  • Matplotlib Code Generation — Automatically generate Python code that recreates your layout.
  • FigureFromLayout — Load saved layouts as Matplotlib figures programmatically.
  • Undo/Redo — Full undo/redo support via the Edit menu or Ctrl+Z / Ctrl+Y.
  • Keyboard Shortcuts — Delete, Ctrl+S, arrow keys for nudging.
  • Multi-Select — Shift+click or rubber-band select; align/distribute operations use the selection.
  • Layout Aids — Snap-to-guides while moving, overlap detection (orange outline), 90° rotation.
  • Per-Side Margins — Configure left, right, top, and bottom margins independently.
  • Open Recent — Track recently opened layouts.
  • Auto Panel Labels — Automatically assign sequential labels (a., b., c., ...) to panels.

Usage

GUI

  1. Select a box: Left-click on an axis box to select it (highlighted in red).
  2. Choose Interaction Mode: Use the radio buttons on the right panel for Move or Resize.
  3. Add boxes: Click the New Panel button.
  4. Deselect: Right-click anywhere on the canvas.
  5. Optimize: Click Optimize to snap all boxes to the nearest half-centimeter.
  6. Save/Load: Use File → Save (Ctrl+S) to overwrite the current file, File → Save As... to choose a new location, or File → Load to open a saved layout.
  7. Default Template: Use File → Save as Default Template to set the current layout (including canvas size and margins) as the startup default.
  8. Settings: Use File → Settings to configure default canvas size, margins, grid spacing, and templates directory.
  9. Generate Code: Click Generate Code to create a Matplotlib code snippet.

Programmatic: FigureFromLayout

Once you have a layout saved, generate it directly in Python:

from axisblueprint import FigureFromLayout
fig, axes = FigureFromLayout("default")

Load from a custom directory:

fig, axes = FigureFromLayout("my_layout", "/path/to/my/layouts")

Returns a matplotlib.Figure and a list of matplotlib.axes.Axes objects.

Layout File Format

Layouts are saved as JSON files. The format includes versioning for forward compatibility:

{
  "version": 1,
  "canvas": {
    "width_cm": 21.0,
    "height_cm": 29.7,
    "margins": { "left": 1.0, "right": 1.0, "top": 1.0, "bottom": 1.0 }
  },
  "boxes": [
    { "x": 1.0, "y": 1.0, "width": 9.25, "height": 6.675, "panel_label": "A" }
  ]
}

API Reference

AxisBox(x, y, width, height, panel_label="")

A single panel in the layout. Coordinates and dimensions are in centimeters.

BlueprintBuilder()

Launch the Tkinter GUI.

LayoutDesigner(parent)

Embed the layout designer in an existing Tkinter application.

figure_from_layout(layout_name, layouts_dir=None)

Load a saved layout and return a Matplotlib figure with axes.

generate_matplotlib_code(boxes, page_width_cm, page_height_cm)

Generate a Python script string for the given layout.

Configuration

  • Settings: ~/.config/axisblueprint/settings.json — default canvas size, margins, grid spacing, and templates directory (editable via File → Settings in the GUI).
  • Templates directory: ~/.config/axisblueprint/templates/ — contains saved layouts and default.json (loaded on startup).
  • Override: Set the AXISBLUEPRINT_TEMPLATES_DIR environment variable to use a custom templates directory.
  • Recent layouts: ~/.config/axisblueprint/recent_layouts.json

Contributing

Contributions are welcome! Please open issues or submit pull requests on GitHub.

Development

Clone and install in editable mode:

git clone https://github.com/NikDrummond/AxisBlueprint.git
cd AxisBlueprint
pip install -e ".[plot]"

Run tests:

python -m pytest tests/

License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for axisblueprint 0.2.0

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

Source distribution (sdist)

Source distribution for axisblueprint 0.2.0
File Size Uploaded Provenance Actions
axisblueprint-0.2.0.tar.gz 27.1 kB Without provenance Details for axisblueprint-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 52.8 kB

Release files / axisblueprint-0.2.0.tar.gz

Download URL axisblueprint-0.2.0.tar.gz
Size 27.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8f870425a3b9ee7ac537bb4aedb2f62be589d179925e9d49d1819bf0e8a531fc
BLAKE2b-256 checksum
How to use checksums
7735a6bc2da2cfbbbaa0293598d74c80106643baa6ccf5372f4c2b305adaa5f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / axisblueprint-0.2.0-py3-none-any.whl

Download URL axisblueprint-0.2.0-py3-none-any.whl
Size 25.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c004229d1d9512e1d619cd7fb100fd94eee5a4e8063d0c8dfff8fdf532c06acb
BLAKE2b-256 checksum
How to use checksums
360a57eaab9d909533b0e52918e7ea7fe4dcd9e275a35d0adf1801d43b91a418
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for axisblueprint 0.2.0

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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