【Matplotlib】 标注摄氏度符号

以前论文中做图遇到的,其实也很简单。code

关键的代码以下:utf-8

ax.set_xlabel('Temperature ($^\circ$C)')

完整的样例代码以下:ci

# -*- 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 ($^\circ$C)')

最终的图像以下:文档

提醒:关于其余特殊符号的绘制,请参考matplotlib的官方文档中关于text部分的内容。import

相关文章
相关标签/搜索