Getting Started
This guide is designed as a short, practical path:
Install dependencies
Generate your first plot
Learn how output files are created
Use shared axes and custom data file names
Installation
Requirements
Python 3.7 or later
numpy >= 1.16.0
Install gleplot
From source (recommended for development):
git clone https://github.com/BenHuddart/gleplot.git
cd gleplot
pip install -e .
With development dependencies:
pip install -e ".[dev]"
Install GLE (optional but recommended)
GLE is required for direct PDF/PNG/EPS compilation. The recommended install path is the official release page:
Verify your install:
gle -finddeps
gle -info
Prefer a GUI? Try the desktop editor
If you’d rather build figures interactively than write Python, gleplot ships a PySide6 desktop editor with a live preview. Download a prebuilt Windows or macOS app from the GitHub Releases page, or install it into a Python environment and launch it:
pip install "gleplot[gui]"
gleplot-gui
The editor uses the same GLE install described above for its live preview and compiled export. See GUI Editor for the full walkthrough.
First Plot (Step by Step)
import numpy as np
import gleplot as glp
# 1) Create data
x = np.linspace(0, 10, 100)
y = np.sin(x)
# 2) Create figure and axis
fig = glp.figure(figsize=(8, 6))
ax = fig.add_subplot(111)
# 3) Plot and label
ax.plot(x, y, label='sin(x)')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_title('My first gleplot figure')
ax.legend()
# 4) Save
fig.savefig('first_plot.gle') # Always works (script + data files)
fig.savefig('first_plot.pdf') # Requires GLE installed
How Output Files Work
When you call savefig, gleplot writes:
a main
.glescript fileone or more external
.datfiles containing plotting data
By default, data files use a global pattern like data_0.dat, data_1.dat, etc.
If you want to keep each export self-contained, pass folder=True to savefig.
For example, fig.savefig('first_plot.pdf', folder=True) creates a
first_plot.gleplot directory containing the compiled output, the
intermediate .gle script, and the generated .dat files.
New: Custom Data File Names
Use data_prefix when creating a figure (or via subplots) to control the
data-file naming scheme.
import numpy as np
import gleplot as glp
x = np.linspace(0, 1, 20)
y = x**2
fig = glp.figure(data_prefix='experimentA')
ax = fig.add_subplot(111)
ax.plot(x, y)
fig.savefig('experimentA_plot.gle')
This produces files such as:
experimentA_plot.gleexperimentA_0.dat
The prefix is used verbatim (note the preserved capital A), so it must be
usable as a GLE data filename. Whitespace, control characters, !, ",
+ and the path separators / and \ raise ValueError when the
figure is created, rather than producing a script that fails to compile. See
docs/guides/CONFIGURATION.md for the full list.