ternary-diagram


Nameternary-diagram JSON
Version 3.2.1 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2025-02-17 03:44:06
maintaineryu9824
docs_urlNone
authoryu9824
requires_python>=3.8
licenseMIT 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.
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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 Version](https://img.shields.io/conda/vn/conda-forge/ternary-diagram.svg)](https://anaconda.org/conda-forge/ternary-diagram)
[![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/ternary-diagram.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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ternary-diagram",
    "maintainer": "yu9824",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "yu9824",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/64/20/8d0a232834dc10726a998892c012536943b053ac8117dd190b92d0bb400e/ternary_diagram-3.2.1.tar.gz",
    "platform": null,
    "description": "# Ternary Diagram\n\n[![python_badge](https://img.shields.io/pypi/pyversions/ternary-diagram)](https://pypi.org/project/ternary-diagram/)\n[![license_badge](https://img.shields.io/pypi/l/ternary-diagram)](https://pypi.org/project/ternary-diagram/)\n[![PyPI version](https://badge.fury.io/py/ternary-diagram.svg)](https://pypi.org/project/ternary-diagram/)\n[![Downloads](https://static.pepy.tech/badge/ternary-diagram)](https://pepy.tech/project/ternary-diagram)\n\n[![CI](https://github.com/yu9824/ternary-diagram/actions/workflows/CI.yml/badge.svg)](https://github.com/yu9824/ternary-diagram/actions/workflows/CI.yml)\n[![docs](https://github.com/yu9824/ternary-diagram/actions/workflows/docs.yml/badge.svg)](https://github.com/yu9824/ternary-diagram/actions/workflows/docs.yml)\n[![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)\n[![Conda Version](https://img.shields.io/conda/vn/conda-forge/ternary-diagram.svg)](https://anaconda.org/conda-forge/ternary-diagram)\n[![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/ternary-diagram.svg)](https://anaconda.org/conda-forge/ternary-diagram)\n\nThis package makes it easier for you to draw beautiful ternary diagram **without** [pymatgen](https://pymatgen.org).\n\nMeaningly, only need `numpy>=1.20` and `matplotlib`.\n\n## What you will be able to do with this package\n\n- Create beautiful contour maps easily\n- Creating a scatter plot\n- Draw tie lines\n- Automatically format chemical composition using subscripts\n- Most of the matplotlib options are available\n\n![/example/contour/example_contour.png](https://github.com/yu9824/ternary-diagram/blob/main/example/contour/example_contour.png?raw=true \"example\")\n\n## How to install\n\n### PyPI\n\n```bash\npip install ternary-diagram\n```\n\nPyPI project is [here](https://pypi.org/project/ternary-diagram/).\n\n### Anaconda\n\n```bash\nconda install -c conda-forge ternary-diagram\n```\n\nAnaconda (conda-forge) package site is [here](https://anaconda.org/conda-forge/ternary-diagram).\n\n## Usage\n\nSee [Examples](#examples) and the [documentation](https://yu9824.github.io/ternary-diagram/).\n\n### Examples\n\nAn easy example is here.\n\n```python\nimport matplotlib.pyplot as plt\nfrom ternary_diagram import TernaryDiagram\n\n# You can set `ax` to select which axes to draw. If not, the current axes will be used.\ntd = TernaryDiagram([\"Li2O\", \"La2O3\", \"TiO2\"])\n\n# scatter\ntd.scatter(vector=[[1, 1, 1], [1, 2, 3]], z=[0, 1])\n# You can set some options in `plt.scatter` like `marker`, `c` etc.\ntd.scatter(vector=[[2, 1, 3], [3, 2, 1]], marker=\"s\", c=\"#022c5e\", s=30)\n\n# line plot\n# You can set some options in `plt.plot` like `lw`, `c`, and so on.\ntd.plot([[1, 1, 1], [1, 2, 3]], color=\"black\")\n\n# save figure\ntd.fig.savefig(\"figure.png\", dpi=144)\n\n```\n\n![/example/example_on_readme/figure.png](https://github.com/yu9824/ternary-diagram/blob/main/example/example_on_readme/figure.png?raw=true)\n\nIt can be written like this.\n```python\n# The background color is sometimes transparent in jupyter notebooks, so set facecolor 'white'.\nfig, ax = plt.subplots(facecolor=\"w\")\n\n# You can set `ax` to select which axes to draw. If not, the current axes will be used.\ntd = TernaryDiagram([\"Li2O\", \"La2O3\", \"TiO2\"], ax=ax)\n\n# scatter\ntd.scatter(vector=[[1, 1, 1], [1, 2, 3]], z=[0, 1])\n# You can set some options in `plt.scatter` like `marker`, `c` etc.\ntd.scatter(vector=[[2, 1, 3], [3, 2, 1]], marker=\"s\", c=\"#022c5e\", s=30)\n\n# line plot\n# You can set some options in `plt.plot` like `lw`, `c`, and so on.\ntd.plot([[1, 1, 1], [1, 2, 3]], color=\"black\")\n\n# save figure\nfig.savefig(\"figure.png\", dpi=144)\n\n```\n\nIt means that you can draw multiple figures in one figure object.\n\nSee also the [example](https://github.com/yu9824/ternary-diagram/tree/main/example) folder.\n\n## Histories\n\n### v3.1.0\n\n- Delete `.utils._BasePlotter.get_x_y` (we should access directly).\n- Resolve #10 (Create `fill` argument in `TernaryDiagram.contour`).\n- Resolve #11 (Create `auto_latex_notation` argument in `TernaryDiagram`).\n- Update documentation.\n- Update docstrings and typings.\n\n\n## LICENSE\n\nSee [LICENSE](https://github.com/yu9824/ternary-diagram/tree/main/LICENSE).\n\nMIT Licence\n\nCopyright (c) 2021 yu9824\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2021 yu9824\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.\n        ",
    "summary": null,
    "version": "3.2.1",
    "project_urls": {
        "Documentation": "https://yu9824.github.io/ternary-diagram/",
        "Homepage": "https://github.com/yu9824/ternary-diagram",
        "PyPI": "https://pypi.org/project/ternary-diagram/",
        "Source": "https://github.com/yu9824/ternary-diagram",
        "Tracker": "https://github.com/yu9824/ternary-diagram/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "39f582753829978ab67a3b2f65af2b6cf2ce20034d9d3b8935a2380cf3385957",
                "md5": "0c4fb800ecf6d1d6eb1380d16836fce8",
                "sha256": "4572fa89e728e52da0251e8926963fefc8e65aee249c868c7f4b7f0a2fb655d7"
            },
            "downloads": -1,
            "filename": "ternary_diagram-3.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0c4fb800ecf6d1d6eb1380d16836fce8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11939,
            "upload_time": "2025-02-17T03:44:05",
            "upload_time_iso_8601": "2025-02-17T03:44:05.222420Z",
            "url": "https://files.pythonhosted.org/packages/39/f5/82753829978ab67a3b2f65af2b6cf2ce20034d9d3b8935a2380cf3385957/ternary_diagram-3.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "64208d0a232834dc10726a998892c012536943b053ac8117dd190b92d0bb400e",
                "md5": "3a6932870c84fa4e16ca313f3e9eab95",
                "sha256": "9c58793619dd84a08c3d5c2aea08c91b53c6766d515edbc34d4b728518e1f331"
            },
            "downloads": -1,
            "filename": "ternary_diagram-3.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3a6932870c84fa4e16ca313f3e9eab95",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 13285,
            "upload_time": "2025-02-17T03:44:06",
            "upload_time_iso_8601": "2025-02-17T03:44:06.980016Z",
            "url": "https://files.pythonhosted.org/packages/64/20/8d0a232834dc10726a998892c012536943b053ac8117dd190b92d0bb400e/ternary_diagram-3.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-17 03:44:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yu9824",
    "github_project": "ternary-diagram",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "ternary-diagram"
}
        
Elapsed time: 0.47837s