This package makes it easier for you to draw beautiful ternary diagram without pymatgen.
MIT License
This package makes it easier for you to draw beautiful ternary diagram without pymatgen.
Meaningly, only need numpy
and matplotlib
.
pip install ternary-diagram
PyPI project is here.
conda install -c conda-forge ternary-diagram
Anaconda (conda-forge) package site is here.
See Examples and the documentation.
An easy example is here.
import matplotlib.pyplot as plt
from ternary_diagram import TernaryDiagram
# You can set `ax` to select which axes to draw. If not, the current axes will be used.
td = TernaryDiagram(["Li2O", "La2O3", "TiO2"])
# scatter
td.scatter(vector=[[1, 1, 1], [1, 2, 3]], z=[0, 1])
# You can set some options in `plt.scatter` like `marker`, `c` etc.
td.scatter(vector=[[2, 1, 3], [3, 2, 1]], marker="s", c="#022c5e", s=30)
# line plot
# You can set some options in `plt.plot` like `lw`, `c`, and so on.
td.plot([[1, 1, 1], [1, 2, 3]], color="black")
# save figure
td.fig.savefig("figure.png", dpi=144)
It can be written like this.
# The background color is sometimes transparent in jupyter notebooks, so set facecolor 'white'.
fig, ax = plt.subplots(facecolor="w")
# You can set `ax` to select which axes to draw. If not, the current axes will be used.
td = TernaryDiagram(["Li2O", "La2O3", "TiO2"], ax=ax)
# scatter
td.scatter(vector=[[1, 1, 1], [1, 2, 3]], z=[0, 1])
# You can set some options in `plt.scatter` like `marker`, `c` etc.
td.scatter(vector=[[2, 1, 3], [3, 2, 1]], marker="s", c="#022c5e", s=30)
# line plot
# You can set some options in `plt.plot` like `lw`, `c`, and so on.
td.plot([[1, 1, 1], [1, 2, 3]], color="black")
# save figure
fig.savefig("figure.png", dpi=144)
It means that you can draw multiple figures in one figure object.
See also the example folder.
.utils._BasePlotter.get_x_y
(we should access directly).fill
argument in TernaryDiagram.contour
).auto_latex_notation
argument in TernaryDiagram
).See LICENSE.
MIT Licence
Copyright (c) 2021 yu9824