您的位置:首页 > 编程语言 > PHP开发

【Matplotlib】 标注摄氏度符号

2016-07-26 16:36 513 查看
之前论文中作图遇到的,其实也很简单。

关键的代码如下:

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
部分的内容。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: