<jupyter_start><jupyter_text>Matplotlib图鉴——进阶面积图 公众号：可视化图鉴<jupyter_code>import matplotlib
print(matplotlib.__version__) #查看Matplotlib版本
import pandas as pd
print(pd.__version__) #查看pandas版本
import numpy as np
print(np.__version__) #查看numpy版本
import matplotlib.pyplot as plt 
plt.rcParams['font.sans-serif'] = ['STHeiti'] #设置中文<jupyter_output>3.3.2
1.2.0
1.19.2<jupyter_text>注意，代码在以下环境全部通过测试:- Python 3.7.1- Matplotlib == 3.3.3- pandas == 1.1.5- numpy == 1.19.5因版本不同，可能会有部分语法差异，如有报错，请先检查拼写及版本是否一致！<jupyter_code>import pandas as pd
import numpy as np
import geopandas as gp
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import matplotlib as mpl
mpl.rcParams['figure.dpi'] = 100
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
plt.rcParams['font.sans-serif'] = ['Microsoft YaHei']
data = pd.read_csv('map.csv')
cn_map = gp.GeoDataFrame.from_file('bou2_4p.shp', encoding = 'gb18030') #读取坐标

data_gp = gp.GeoDataFrame(data)#转换数据格式

cn_map = cn_map.rename(index = str, columns = {'NAME':'省份'})
data1 = cn_map.merge(data_gp, on = '省份', how = 'left')

fig, ax = plt.subplots(figsize=(9,6),dpi = 100)

ax.set_xticks([])
ax.set_yticks([])


divider = make_axes_locatable(ax)
cax = divider.append_axes("left", size="4%", pad=0.5)

data1.plot('粉丝数',ax = ax,cmap=plt.cm.GnBu,legend = True, cax=cax, edgecolor="black",linewidth = 0.8)


plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.151791988756149, 'fraction_numerical': 0.03232607167955025, 'mean_word_length': 6.455497382198953, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '461678', 'license': 'MIT', 'n_tokens_mistral': 686, 'n_tokens_neox': 684, 'n_words': 106, 'path': 'G-地图/MA_G_01/MA_G_01.ipynb', 'repo_name': 'liuhuanshuo/zaoqi-data', 'size': '1423'}