import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
饼图
m = 51212
f = 40742
m_perc = m/(m+f)
f_perc = f/(m+f)
colors = ['navy','lightcoral']
labels = ['Male','Female']
plt.figure(figsize=(12,12))
patches, texts, autotexts = plt.pie([m_perc,f_perc],labels=labels, autopct='%1.1f%%', explode=[0,0.05], colors=colors)

m = 51212
f = 40742
m_perc = m/(m+f)
f_perc = f/(m+f)
colors = ['navy','lightcoral']
labels = ['Male','Female']
plt.figure(figsize=(12,12))
patches, texts, autotexts = plt.pie([m_perc,f_perc],labels=labels, autopct='%1.1f%%', explode=[0,0.05], colors=colors)
for text in texts+autotexts:
text.set_fontsize(20)
for text in autotexts:
text.set_color('white')
