我想并排放置 2 个圆环图,目前,我并排放置一个饼图和圆环图。
甜甜圈图
这是我的代码,我需要一个循环吗?
recipe = "flour","sugar","egg","butter","milk","yeast"
fracs = [15, 30, 45, 10]
data = [225, 90, 50, 60, 100, 5]
fig = plt.figure()
ax1 = fig.add_axes([0, 0, .5, .5], aspect=1)
ax1.pie(data, labels=recipe, radius = 1.2)
ax2 = fig.add_axes([.5, .0, .5, .5], aspect=1)
ax2.pie(data, labels=recipe, radius = 1.2)
circle = plt.Circle((0,0), 0.7, color='white')
p=plt.gcf()
p.gca().add_artist(circle)
ax1.set_title('A donut', y=1.1)
ax2.set_title('A donut',y=1.1)
plt.savefig('donut1.png')
plt.show()
神不在的星期二
相关分类