Skip to main content

Log-ternary plots for fold-change visualization between three conditions.

Project description

logternary

CI PyPI Python

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:

Key properties

Transcriptome data

Simulated gene expression data across three conditions, with differentially expressed genes highlighted:

Transcriptome

Exchange rate trajectories

Monthly exchange rate trajectories visualized as a path through log-ternary space:

Exchange rates

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

logternary-0.0.0a0.tar.gz (430.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

logternary-0.0.0a0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

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

Hashes for logternary-0.0.0a0.tar.gz
Algorithm Hash digest
SHA256 f90ffaec99b612de013761faf8f26d73147958c01445061c94738d1120c4956e
MD5 6e311806148f00974e185002a21f52a2
BLAKE2b-256 daef053c50138235d49634c98204adaccc1f11e28af1ca618404339eb641507f

See more details on using hashes here.

Provenance

The following attestation bundles were made for logternary-0.0.0a0.tar.gz:

Publisher: release.yml on gatoniel/logternary

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for logternary-0.0.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 f91deb8dddd2632a2b9af3ec4479a609ac63cc3ce2896124590b626c9982193c
MD5 b287033ffd2eece9e9008bed35458cf1
BLAKE2b-256 af78d47dbd966fe81dd4e78ee091d398000fc02277fc2f1d7644dd7749423fac

See more details on using hashes here.

Provenance

The following attestation bundles were made for logternary-0.0.0a0-py3-none-any.whl:

Publisher: release.yml on gatoniel/logternary

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page