mpltern: Ternary plots with Matplotlib

PyPI version Downloads Conda Version Conda Downloads

GitHubActions CircleCI

DOI

Mpltern (https://yuzie007.github.io/mpltern) is a Python plotting library based on Matplotlib specifically designed for ternary plots. Mpltern is implemented as a new projection for Matplotlib, with introducing e.g. new Transform classes for ternary plots. The followings are the features of mpltern when compared with other ternary-plot libraries:

  • Many things one expects essentially possible using Matplotlib can be done also in mpltern, without e.g. ternary-to-Cartesian conversions on the user side

  • For the same plotting styles, mpltern offers the same or very similar method names as Matplotlib does; you do not need to learn many new commands in addition to those for Matplotlib

  • Tick markers, tick labels, and axis labels are automatically positioned with reasonable paddings inherited from Matplotlib; this allows users e.g. faster production of ternary plots with publication quality

  • tight_layout and constrained_layout

  • Easy combination with normal Matplotlib plots

  • Easy application of seaborn styles

  • Working also in Matplotlib interactive modes inside e.g. Jupyter notebooks

https://mpltern.readthedocs.io/en/latest/_images/sphx_glr_with_seaborn_styles_001.svg https://mpltern.readthedocs.io/en/latest/_images/sphx_glr_05.inset_001.svg https://mpltern.readthedocs.io/en/latest/_images/sphx_glr_07.polygon_001.svg https://mpltern.readthedocs.io/en/latest/_images/sphx_glr_02.arbitrary_triangle_001.svg
https://mpltern.readthedocs.io/en/latest/_images/sphx_glr_01.scatter_001.svg https://mpltern.readthedocs.io/en/latest/_images/sphx_glr_08.quiver_001.svg
https://mpltern.readthedocs.io/en/latest/_images/sphx_glr_02.contour_001.svg https://mpltern.readthedocs.io/en/latest/_images/sphx_glr_03.pseudocolor_001.svg
https://mpltern.readthedocs.io/en/latest/_images/sphx_glr_with_scatter_001.svg https://mpltern.readthedocs.io/en/latest/_images/sphx_glr_tick_position_001.svg

Installation

See the install documentation.

How to Cite mpltern

The author requests to cite mpltern via the DOI above if mpltern contributes to a scientific publication. Of course, Matplotlib should be also very much acknowledged when using mpltern.

Author

Yuji Ikeda (GitHub, Google Scholar, ResearchGate)