Metadata-Version: 2.2
Name: ternary-diagram
Version: 3.2.0
Author: yu9824
Maintainer: yu9824
License: MIT License
        
        Copyright (c) 2021 yu9824
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/yu9824/ternary-diagram
Project-URL: Documentation, https://yu9824.github.io/ternary_diagram/
Project-URL: PyPI, https://pypi.org/project/ternary-diagram/
Project-URL: Source, https://github.com/yu9824/ternary-diagram
Project-URL: Tracker, https://github.com/yu9824/ternary-diagram/issues
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Scientific/Engineering :: Chemistry
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.20
Requires-Dist: matplotlib
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pandas; extra == "test"
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: jupyter; extra == "dev"
Requires-Dist: pandas; extra == "dev"
Provides-Extra: optional
Requires-Dist: colorlog; extra == "optional"
Requires-Dist: tqdm; extra == "optional"
Provides-Extra: docs
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: sphinx_rtd_theme; extra == "docs"
Requires-Dist: sphinx-markdown-tables; extra == "docs"
Requires-Dist: recommonmark; extra == "docs"
Requires-Dist: sphinx-multiversion; extra == "docs"
Provides-Extra: gui
Requires-Dist: TkEasyGUI; extra == "gui"

# Ternary Diagram

[![python_badge](https://img.shields.io/pypi/pyversions/ternary-diagram)](https://pypi.org/project/ternary-diagram/)
[![license_badge](https://img.shields.io/pypi/l/ternary-diagram)](https://pypi.org/project/ternary-diagram/)
[![PyPI version](https://badge.fury.io/py/ternary-diagram.svg)](https://pypi.org/project/ternary-diagram/)
[![Downloads](https://static.pepy.tech/badge/ternary-diagram)](https://pepy.tech/project/ternary-diagram)

[![CI](https://github.com/yu9824/ternary_diagram/actions/workflows/CI.yml/badge.svg)](https://github.com/yu9824/ternary_diagram/actions/workflows/CI.yml)
[![docs](https://github.com/yu9824/ternary_diagram/actions/workflows/docs.yml/badge.svg)](https://github.com/yu9824/ternary_diagram/actions/workflows/docs.yml)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![conda_badge](https://anaconda.org/conda-forge/ternary-diagram/badges/version.svg)](https://anaconda.org/conda-forge/ternary-diagram/)
[![arch_badge](https://anaconda.org/conda-forge/ternary-diagram/badges/platforms.svg)](https://anaconda.org/conda-forge/ternary-diagram)

This package makes it easier for you to draw beautiful ternary diagram **without** [pymatgen](https://pymatgen.org).

Meaningly, only need `numpy>=1.20` 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

![/example/contour/example_contour.png](https://github.com/yu9824/ternary_diagram/blob/main/example/contour/example_contour.png?raw=true "example")

## How to install

### PyPI

```bash
pip install ternary-diagram
```

PyPI project is [here](https://pypi.org/project/ternary-diagram/).

### Anaconda

```bash
conda install -c conda-forge ternary-diagram
```

Anaconda (conda-forge) package site is [here](https://anaconda.org/conda-forge/ternary-diagram).

## Usage

See [Examples](#examples) and the [documentation](https://yu9824.github.io/ternary_diagram/).

### Examples

An easy example is here.

```python
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)

```

![/example/example_on_readme/figure.png](https://github.com/yu9824/ternary_diagram/blob/main/example/example_on_readme/figure.png?raw=true)

It can be written like this.
```python
# 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](https://github.com/yu9824/ternary_diagram/tree/main/example) folder.

## Histories

### v3.1.0

- Delete `.utils._BasePlotter.get_x_y` (we should access directly).
- Resolve #10 (Create `fill` argument in `TernaryDiagram.contour`).
- Resolve #11 (Create `auto_latex_notation` argument in `TernaryDiagram`).
- Update documentation.
- Update docstrings and typings.


## LICENSE

See [LICENSE](https://github.com/yu9824/ternary_diagram/tree/main/LICENSE).

MIT Licence

Copyright (c) 2021 yu9824
