Log-ternary plots for fold-change visualization between three conditions.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logternary-0.0.0a0.tar.gz.
File metadata
- Download URL: logternary-0.0.0a0.tar.gz
- Upload date:
- Size: 430.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f90ffaec99b612de013761faf8f26d73147958c01445061c94738d1120c4956e
|
|
| MD5 |
6e311806148f00974e185002a21f52a2
|
|
| BLAKE2b-256 |
daef053c50138235d49634c98204adaccc1f11e28af1ca618404339eb641507f
|
Provenance
The following attestation bundles were made for logternary-0.0.0a0.tar.gz:
Publisher:
release.yml on gatoniel/logternary
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
logternary-0.0.0a0.tar.gz -
Subject digest:
f90ffaec99b612de013761faf8f26d73147958c01445061c94738d1120c4956e - Sigstore transparency entry: 1155008711
- Sigstore integration time:
-
Permalink:
gatoniel/logternary@6ede7205e87e1ce84c15585fec8acdfee9766360 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/gatoniel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6ede7205e87e1ce84c15585fec8acdfee9766360 -
Trigger Event:
push
-
Statement type:
File details
Details for the file logternary-0.0.0a0-py3-none-any.whl.
File metadata
- Download URL: logternary-0.0.0a0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f91deb8dddd2632a2b9af3ec4479a609ac63cc3ce2896124590b626c9982193c
|
|
| MD5 |
b287033ffd2eece9e9008bed35458cf1
|
|
| BLAKE2b-256 |
af78d47dbd966fe81dd4e78ee091d398000fc02277fc2f1d7644dd7749423fac
|
Provenance
The following attestation bundles were made for logternary-0.0.0a0-py3-none-any.whl:
Publisher:
release.yml on gatoniel/logternary
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
logternary-0.0.0a0-py3-none-any.whl -
Subject digest:
f91deb8dddd2632a2b9af3ec4479a609ac63cc3ce2896124590b626c9982193c - Sigstore transparency entry: 1155008714
- Sigstore integration time:
-
Permalink:
gatoniel/logternary@6ede7205e87e1ce84c15585fec8acdfee9766360 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/gatoniel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6ede7205e87e1ce84c15585fec8acdfee9766360 -
Trigger Event:
push
-
Statement type: