This release is a pre-release and may not be stable for production use.
Ternary Diagram
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.
Features
- Contour maps, scatter plots, tie lines and annotations of compositions
- Automatic formatting of chemical formulas with subscripts (
Li2Obecomes 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)
Documentation
The documentation is at https://yu9824.github.io/ternary-diagram/.
- User guide: getting started, customizing the diagram, phase diagrams, heatmaps and contour maps, layout and colorbars
- Tutorials: example notebooks
- API reference
- Migrating to v4.0.0: changes of the defaults planned for v4.0.0 and how to prepare for them
Changelog
See CHANGELOG.md and GitHub Releases.
License
MIT License. See LICENSE.
Copyright (c) 2021 yu9824
Metadata
Release files for ternary-diagram 3.3.0rc0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ternary_diagram-3.3.0rc0.tar.gz | 2.7 MB | With provenance | Details for ternary_diagram-3.3.0rc0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ternary_diagram-3.3.0rc0-py3-none-any.whl | Python 3 | none | any | Details for ternary_diagram-3.3.0rc0-py3-none-any.whl |
Total release size: 2.8 MB
Release files / ternary_diagram-3.3.0rc0.tar.gz
| Download URL | ternary_diagram-3.3.0rc0.tar.gz |
|---|---|
| Size | 2.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a945580403f3cf5147c60c6b725ceb28e1f5555c161d646b81913d5000e9ee7d
|
|
BLAKE2b-256 checksum How to use checksums |
77193c1dd0a368a86f54039dc699b06c60f5998fede05444ab11d1e469f20c64
|
| 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 16, 2026.
Transparency logRelease files / ternary_diagram-3.3.0rc0-py3-none-any.whl
| Download URL | ternary_diagram-3.3.0rc0-py3-none-any.whl |
|---|---|
| Size | 64.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b06e991ac8ea302b65ac305e9035458a74923d3ae05755ecaeb7feb266d1973e
|
|
BLAKE2b-256 checksum How to use checksums |
98176c6170b56b32008c36dcb27596038c264fa9a1826669512b6342e54c7d7a
|
| 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 16, 2026.
Transparency logSecurity for ternary-diagram 3.3.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.
Attestation for ternary_diagram-3.3.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 16, 2026.
Transparency logA 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.