Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Trying to put per mille symbol into plot label usinf matplotlib

I can’t figure out how to put the per mille symbol into my plt.ylabel. anyone know how?

    import numpy as np  
    import matplotlib.pyplot as plt
    plt.plot(x,y)

    ax = plt.gca()
    ax.invert_yaxis()

    plt.title("LR04 Benthic $\delta^{18}$O")
    plt.xlabel("Years (ka)")
    plt.ylabel("Benthic $\delta^{18}O (TRYING TO PUT PERMIL SYMBOL HERE)$")
    plt.show()

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

One possible solution:

import numpy as np  
import matplotlib.pyplot as plt

x = np.linspace(-5, 5)
y = np.cos(x)
fig, ax = plt.subplots()
ax.plot(x, y)
ax.invert_yaxis()

ax.set_title("LR04 Benthic $\delta^{18}$O")
ax.set_xlabel("Years (ka)")
ax.set_ylabel("Benthic $^o/_{oo}$")
plt.show()
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading