Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Ternary Diagram

python_badge license_badge PyPI version Downloads

CI docs Ruff Conda Version Conda Platforms

ternary-diagram draws ternary diagrams of three-component compositions on matplotlib, without pymatgen. It only requires numpy>=1.20 and matplotlib, and draws on any matplotlib Axes.

A contour map of a ternary system drawn with ternary-diagram

Features

  • Contour maps, scatter plots, tie lines and annotations of compositions
  • Automatic formatting of chemical formulas with subscripts (Li2O becomes Li2O)
  • Customizable diagram parts: border, grid, tick labels, axis titles and vertex labels
  • Phase diagrams: filled regions (fill) and labels placed at compositions (text)
  • Heatmaps: of scattered data (tripcolor) and of a function of the composition (heatmapf)
  • Control over the automatic layout adjustment and colorbars, respecting the figure's layout engine
  • Keyword arguments are passed through to matplotlib, and matplotlib objects are returned

Installation

pip install ternary-diagram

or, from conda-forge:

conda install -c conda-forge ternary-diagram

Quick start

import matplotlib.pyplot as plt

from ternary_diagram import TernaryDiagram

fig, ax = plt.subplots(layout="constrained")
td = TernaryDiagram(["Li2O", "La2O3", "TiO2"], ax=ax)

# scatter plot colored by values
td.scatter(vector=[[1, 1, 1], [1, 2, 3]], z=[0, 1])
# keyword arguments are passed to `Axes.scatter`
td.scatter(vector=[[2, 1, 3], [3, 2, 1]], marker="s", c="#022c5e", s=30)

# line plot; keyword arguments are passed to `Axes.plot`
td.plot([[1, 1, 1], [1, 2, 3]], color="black")

fig.savefig("figure.png", dpi=144)

The figure drawn by the quick start example

Documentation

The documentation is at https://yu9824.github.io/ternary-diagram/.

Changelog

See CHANGELOG.md and GitHub Releases.

License

MIT License. See LICENSE.

Copyright (c) 2021 yu9824

Metadata

Release files for ternary-diagram 3.4.0rc0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ternary-diagram 3.4.0rc0
File Size Uploaded Provenance Actions
ternary_diagram-3.4.0rc0.tar.gz 2.7 MB With provenance Details for ternary_diagram-3.4.0rc0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ternary-diagram 3.4.0rc0
File Interpreter ABI Platform Actions
ternary_diagram-3.4.0rc0-py3-none-any.whl Python 3 none any Details for ternary_diagram-3.4.0rc0-py3-none-any.whl

Total release size: 2.8 MB

Release files / ternary_diagram-3.4.0rc0.tar.gz

Download URL ternary_diagram-3.4.0rc0.tar.gz
Size 2.7 MB
Tags Source
SHA-256 checksum
How to use checksums
59f06f2b6af1be53d1df99adeedfeaf3f70f70b02470cf4dedb6113757bbb919
BLAKE2b-256 checksum
How to use checksums
25aba42144f95dcfdf39e80b08abec11498da058e65b822700c179ffce9f9615
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Release files / ternary_diagram-3.4.0rc0-py3-none-any.whl

Download URL ternary_diagram-3.4.0rc0-py3-none-any.whl
Size 66.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eaa724845ccc945f9d9719f35be797d2f94621c414619b5da54cb9711e8f280f
BLAKE2b-256 checksum
How to use checksums
38d2709992c1deec4b9eddb08de702181dd52cbb3d01162ef2b6167451a20e4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Security for ternary-diagram 3.4.0rc0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ternary_diagram-3.4.0rc0.tar.gz

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 Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page