1.源代码
#coding=utf-8
import numpy as np;
import matplotlib.pyplot as plt;
import math;
fig = plt.figure(figsize=(4,4))
ax = fig.add_subplot(111);
#c=seaborn.xkcd_rgb['baby poop green']
langs = ['N2','O2','OTHER']
students = [78,21,1]
ax.pie(students, labels=langs, autopct='%1.2f%%') #绘制饼图
plt.savefig('pie.png');
2.运行程序
$ python pie.py
3.绘制结果

pie.png