import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from openpyxl.workbook import Workbook
from matplotlib import rcParams
from matplotlib.pyplot import MultipleLocator
config = {
"font.family": 'serif',
"font.size": 15,
"mathtext.fontset": 'stix',
"font.serif": ['SimSun'],
}
rcParams.update(config)
labels = '四川', '云南', '西藏', '中部', '东北', '东部'
sizes = [22, 20, 19, 14, 10, 5]
fig1 = plt.figure()
ax1 = fig1.add_subplot(111)
ax1.pie(sizes, labels=labels, autopct='%1.1f%%', shadow=False)
ax1.axis('equal')
x = np.arange(6)
y = [7714, 6186, 771, 231, 2119, 1665]
name = ['四川', '云南', '重庆', '西藏', '贵州', '广西']
fig = plt.figure()
ax = fig.add_subplot(111)
bars = ax.bar(x, y)
plt.xticks(range(len(name)), name)
i = 0
for bar in bars:
height = bar.get_height()
plt.text(bar.get_x() + bar.get_width() / 2, height, str(height), ha='center', va='baseline')
plt.show()