【Matplotlib】 标注摄氏度符号

之前论文中作图遇到的,其实也很简单。

关键的代码如下:

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

完整的样例代码如下:

# -*- 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部分的内容。

posted @ 2016-07-26 16:36  Chris*Chen  阅读(2555)  评论(0编辑  收藏  举报