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