This package makes it easier for you to draw beautiful ternary diagram without pymatgen.
Project description
Ternary Diagram
This package makes it easier for you to draw beautiful ternary diagram without pymatgen.
Meaningly, only need numpy
and matplotlib
.
What you will be able to do with this package
- Create beautiful contour maps easily
- Creating a scatter plot
- Draw tie lines
- Automatically format chemical composition using subscripts
- Most of the matplotlib options are available
How to install
PyPI
pip install ternary-diagram
PyPI project is here.
Anaconda
conda install -c conda-forge ternary-diagram
Anaconda (conda-forge) package site is here.
Usage
See Examples and the documentation.
Examples
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.
Histories
v3.1.0
- Delete
.utils._BasePlotter.get_x_y
(we should access directly).
LICENSE
See LICENSE.
MIT Licence
Copyright (c) 2021 yu9824
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ternary_diagram-3.1.0.tar.gz
(13.8 kB
view details)
Built Distribution
File details
Details for the file ternary_diagram-3.1.0.tar.gz
.
File metadata
- Download URL: ternary_diagram-3.1.0.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53000a1a67fc4b61bd92f87066294235eae7d6273665c191d43c17bc802ddce2 |
|
MD5 | 076fe65950fa4c3725f0a5a7d2957d8c |
|
BLAKE2b-256 | 0ab1bb80901045075322e370b3633832d9ecff25373890b3279338e526862e80 |
File details
Details for the file ternary_diagram-3.1.0-py3-none-any.whl
.
File metadata
- Download URL: ternary_diagram-3.1.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43ac27e43d281a5a5d642585761c38f799858c505da16e120b8dea183b36de33 |
|
MD5 | 6b01137d2225903ce5eb74ae87d7f802 |
|
BLAKE2b-256 | 78551b97ef34496d867b39a44b5b63f1615aafa068959fc5393ae8a2b8d9cba6 |