Python matplotlib中带有欧元符号的记号

Python matplotlib中带有欧元符号的记号,python,matplotlib,formatting,ascii,Python,Matplotlib,Formatting,Ascii,我正试图设计一个轴心国欧元单位。 我正在格式化的函数是: def money(x, pos): return '$%1.0fB' % (x*1e-9) 而且它在$上运行良好。现在我需要将$与欧元符号交换,这是无法直接识别的 我尝试的是: def money(x, pos): return r'$\euro$%1.0fB' % (x*1e-9) 但是终点站说: Unknown symbol: \euro 您还可以尝试使用\texteuro作为 import matplotli

我正试图设计一个轴心国欧元单位。 我正在格式化的函数是:

def money(x, pos):
    return '$%1.0fB' % (x*1e-9)
而且它在$上运行良好。现在我需要将$与欧元符号交换,这是无法直接识别的

我尝试的是:

def money(x, pos):
    return r'$\euro$%1.0fB' % (x*1e-9)
但是终点站说:

Unknown symbol: \euro

您还可以尝试使用
\texteuro
作为

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()

字符集/UTF-8问题?
“€%1.0fB%”(x*1e-9)
对我来说很好。