【发布时间】:2017-07-25 18:10:37
【问题描述】:
我正在使用 subplot 来显示一些数字,但是标签与最后一个 subplot 混合在一起,因此这些图的大小不相等。而前5个不是完美的圆。
这是我的代码:
for i in range(6):
plt.subplot(231 + i)
plt.title("Department " + depts[i])
labels = ['Male', 'Female']
colors = ['#3498DB', '#E74C3C']
sizes = [male_accept_rates[i] / (male_accept_rates[i] + female_accept_rates[i]),
female_accept_rates[i] / (male_accept_rates[i] + female_accept_rates[i])]
patches, texts = plt.pie(sizes, colors=colors, startangle=90)
plt.axis('equal')
plt.tight_layout()
plt.legend(labels, loc="best")
plt.show()
谁能给我一些建议?非常感谢。
【问题讨论】:
标签: matplotlib graph machine-learning jupyter-notebook data-analysis