This release is a pre-release and may not be stable for production use.
logternary
Log-ternary plots for fold-change visualization between three conditions.
A log-ternary plot maps positive triples (a, b, c) — where only ratios carry meaning — to ℝ² via a symmetric isometric log-ratio transform. The resulting plot has three axes at 120° separation, each representing fold-changes in one condition relative to the geometric mean of the other two.
Installation
pip install logternary
Quick start
import matplotlib.pyplot as plt
import logternary # registers the 'logternary' projection
fig, ax = plt.subplots(
subplot_kw={'projection': 'logternary', 'base': 2, 'max_level': 3,
'labels': ('Wild type', 'Knockout', 'Rescue')}
)
ax.scatter(a, b, c, color='steelblue', s=12)
plt.show()
The three-argument forms ax.scatter(a, b, c), ax.plot(a, b, c), and
ax.annotate('label', a, b, c) are automatically transformed to log-ternary
coordinates. Two-argument calls fall through to standard matplotlib behaviour.
Examples
Key properties
Mirrored points, collinear trajectories, and fold-change transformations:
Transcriptome data
Simulated gene expression data across three conditions, with differentially expressed genes highlighted:
Exchange rate trajectories
Monthly exchange rate trajectories visualized as a path through log-ternary space:
Configuration
All parameters are passed via subplot_kw:
| Parameter | Default | Description |
|---|---|---|
base |
2 |
Logarithm base (2, 10, e) |
max_level |
3 |
Grid levels per axis (base=2, level=3 → 1/8–8×) |
labels |
('a', 'b', 'c') |
Axis labels |
tick_format |
'fold' |
'fold' (2×), 'log' (1), or callable |
Grid visibility: ax.grid(True) / ax.grid(False)
Development
git clone https://github.com/gatoniel/logternary
cd logternary
uv sync --dev
uv run pre-commit install
uv run pytest
License
MIT
Release files for logternary 0.0.0a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| logternary-0.0.0a0.tar.gz | 430.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| logternary-0.0.0a0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 440.4 kB
Release files / logternary-0.0.0a0.tar.gz
| Download URL | logternary-0.0.0a0.tar.gz |
|---|---|
| Size | 430.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f90ffaec99b612de013761faf8f26d73147958c01445061c94738d1120c4956e
|
|
BLAKE2b-256 checksum How to use checksums |
daef053c50138235d49634c98204adaccc1f11e28af1ca618404339eb641507f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 22, 2026.
Transparency logRelease files / logternary-0.0.0a0-py3-none-any.whl
| Download URL | logternary-0.0.0a0-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f91deb8dddd2632a2b9af3ec4479a609ac63cc3ce2896124590b626c9982193c
|
|
BLAKE2b-256 checksum How to use checksums |
af78d47dbd966fe81dd4e78ee091d398000fc02277fc2f1d7644dd7749423fac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 22, 2026.
Transparency log