import matplotlib.pyplot as plt
# 121 > 1行2列第1个
fig1 = plt.subplot(121)
plt.pie([1,2,3])
# 谨芹祥122 >首肢 1行2列第2个
fig2 = plt.subplot(122)
plt.pie([10,5,5])
# 亦可以plt.subplot(221) 2行2列第1个
matplotlib饼状图: https://matplotlib.org/api/_as_gen/matplotlib.pyplot.pie.html
保存图片: https://matplotlib.org/api/_as_gen/matplotlib.pyplot.savefig.html
subplot_adjust: https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplots_adjust.html
enumerate() 函数用于将一个可遍历的数雀粗铅据对象(如列表、元组或字符串)组合为一个索凳亩引序列,同时列出数据和数据下标,一般用在 for 循环当中。
语法顷好:
enumerate(sequence, [start=0])
参数:
sequence -- 一个序列、迭代器或其他支持迭代对象。
start -- 下标起始位置。
返回值:
返回 enumerate(枚举) 对象。
https://www.runoob.com/python/python-func-enumerate.html
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)