Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoalopez committed Oct 6, 2022
1 parent 8a74b66 commit ae54d68
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
![](https://github.com/marcoalopez/ternary_plots/blob/main/imgs/header.jpg?raw=true)
_Brought to you by [Marco A. Lopez-Sanchez](https://marcoalopez.github.io/) - Last update: 2022-10-04_
_Brought to you by [Marco A. Lopez-Sanchez](https://marcoalopez.github.io/) - Last update: 2022-10-06_

## **What is a ternary plot?**

A [ternary plot](https://en.wikipedia.org/wiki/Ternary_plot) is a triangular diagram that displays the proportion of three variables that sum to a constant, usually 1 or 100%. It is a common diagram in solid-earth sciences but is also used in other physical sciences.
A [ternary plot](https://en.wikipedia.org/wiki/Ternary_plot) is a triangular diagram that displays the proportion of three variables that sum to a constant, usually 1 or 100%. It is a common diagram in solid-earth but also in other physical sciences.

## **What is the purpose of this repository?**
You want to use ternary diagrams in your Jupyter notebook (or script) while using Python. Sadly you realise that matplolib does not have ternary plots by default. After some research on the internet, you realise that the alternatives are either to install other plotting libraries (e.g. [Plotly](https://plotly.com/python/ternary-plots/)) or third-party libraries that rely on matplolib (e.g. [python-ternary](https://github.com/marcharper/python-ternary) or [mpltern](https://mpltern.readthedocs.io/en/latest/index.html)). Unfortunately, you don't feel like learning a new syntax for plotting (you are too comfortable with your matplolib buddy) or don't want to install a new Python library with all that this entails (dependencies, etc.) and that it seem too overkill for your needs\*. This is where the good news comes in. You can create a simple ternary diagram in matplolib in few lines of code, where simple means that it has the minimum necessary elements to correctly interpret it. In short, **no installations, no new dependencies, your usual matplolib syntax, and hence no fuss**.
You want to use ternary diagrams in your Jupyter notebook (or Python script). Sadly you realise that matplolib does not have ternary plots by default. After some research on the internet, you realise that the alternatives are either to install other plotting libraries (e.g. [Plotly](https://plotly.com/python/ternary-plots/)) or third-party libraries that rely on matplolib (e.g. [python-ternary](https://github.com/marcharper/python-ternary) or [mpltern](https://mpltern.readthedocs.io/en/latest/index.html)). Unfortunately, you don't feel like learning a new syntax for plotting (you are too comfortable with your matplolib buddy) or don't want to install a new Python library with all that this entails (dependencies, etc.) and that it seem too overkill for your needs\*. This is where the good news comes in. You can create a simple ternary diagram in matplolib in few lines of code, where simple means that it has the minimum necessary elements to correctly interpret it. In short, **no installations, no new dependencies, your usual matplolib syntax, and no fuss**.

\*_I have nothing against these libraries, quite the opposite, if you need more advanced features use them!_

Expand Down Expand Up @@ -171,7 +171,7 @@ ax.legend(fontsize=14)
To create ternary diagrams it is always the same two-step process:

1) Normalise and convert your ternary coordinates to Cartesian coordinates. For this you will use the ``tri2cart()`` function.
2) Then initialize your ternary diagram using the function ``ternary()`` and use your ususal matplolib commands (``plot()``, ``scatter()``, etc.)
2) Then initialize your ternary diagram using the ``ternary()`` function and use your ususal matplolib commands (``plot()``, ``scatter()``, etc.)

> **Important: Usage example, jupyter notebooks and script will be available soon**
Expand Down

0 comments on commit ae54d68

Please sign in to comment.