1

I am trying to plot having one of the axis Euro units. The function I am formatting is:

def money(x, pos):
    return '$%1.0fB' % (x*1e-9)

and it works well with $. Now I need to interchange $ with € symbol, which is not directly recognized.

what I tried is:

def money(x, pos):
    return r'$\euro$%1.0fB' % (x*1e-9)

but the terminal says:

Unknown symbol: \euro
Giacomo
  • 551
  • 2
  • 4
  • 16

1 Answers1

3

You can additionally also try using \texteuro as

import matplotlib.pyplot as plt
from matplotlib import rc
rc('text', usetex=True)

plt.plot(range(5))
plt.xlabel(r'\texteuro%1.0fB')
plt.show()

enter image description here

Sheldore
  • 37,862
  • 7
  • 57
  • 71