Skip to main content

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

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.0
File Size Uploaded Provenance Actions
ternary_diagram-3.4.0.tar.gz 2.7 MB With provenance Details for ternary_diagram-3.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 2.8 MB

Release files / ternary_diagram-3.4.0.tar.gz

Download URL ternary_diagram-3.4.0.tar.gz
Size 2.7 MB
Tags Source
SHA-256 checksum
How to use checksums
7701437158461dfe87b099162ab15872eb61c147515b130fda014a9e1b943b2b
BLAKE2b-256 checksum
How to use checksums
f5a1129f5cc1d7eb19bfe4a36b8cd99b533619c81e8de817a007810ee3d93efe
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.0-py3-none-any.whl

Download URL ternary_diagram-3.4.0-py3-none-any.whl
Size 66.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd5d010cd43fb0934ee4805c508503a32a87566e1ebcde28becc4a00f7256776
BLAKE2b-256 checksum
How to use checksums
0addbb0c06fdcfc4518d3480f9f2c6f7795aa28bf40a86bac8e72c89bb17ebbf
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.0

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