我想打印一个坐标轴标签:“温度(℃)”。我该如何做?代码示例:
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
x = range(10,60,1)
y = range(-100, 0, 2)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x,y)
ax.set_xlabel('Temperature (℃)')
对于最后一行,我已经尝试过:
ax.set_xlabel('Temperature (℃)'.encode('utf-8'))
ax.set_xlabel(u'Temperature (u\2103)')
ax.set_xlabel(u'Temperature (℃)')
ax.set_xlabel(u'Temperature (\u2103)')
ax.set_xlabel('Temperature (\u2103)')
我就是不明白。我正在使用Spyder并从那里运行代码。