yuzie007 / mpltern

Ternary plots as projections of Matplotlib
https://yuzie007.github.io/mpltern
MIT License
39 stars 2 forks source link

Non-standard axis directions #9

Open AndrewFalkowski opened 1 year ago

AndrewFalkowski commented 1 year ago

Looking to replicate a non-standard ternary plot where the left and bottom axis increase from the bottom left corner (example). This structure is fairly standard in my field, but I haven't found a single ternary plotting library capable of replicating it. Wondering if there is some way to define custom axis directions in your library?

Thanks!

yuzie007 commented 1 year ago

Thank you @AndrewFalkowski for taking a look on mpltern. Please find the following snippet, which may mostly reproduce the tick style in your example.

import matplotlib.pyplot as plt
import mpltern

ax = plt.subplot(projection="ternary")

ax.plot([0.1, 0.2], [0.2, 0.4], [0.7, 0.4])

ax.set_tlabel("Sn")
ax.set_llabel("Bi")
ax.set_rlabel("Cu")

ax.taxis.set_tick_params(
    which="both",
    tick1On=True,
    label1On=False,
    tick2On=True,
    label2On=True,
)
ax.laxis.set_tick_params(
    which="both",
    tick1On=True,
    label1On=False,
    tick2On=True,
    label2On=False,
)
ax.raxis.set_tick_params(
    which="both",
    tick1On=True,
    label1On=True,
    tick2On=True,
    label2On=False,
)

plt.show()