Shen, Chi
Feb 20 2020, New Haven, CT
不小心手欠把之前上传的内容给删除了,实在想不起来写了什么
from shapely.geometry import LineString
import matplotlib
import matplotlib.pyplot as plt
from fiona.crs import from_epsg
matplotlib.rcParams['font.family'] = 'sans-serif'
matplotlib.rcParams['font.sans-serif'] = 'STSong,Times New Roman'
fp_chn = "/Users/Chi/Documents/Method Learn/Statistic for Spatial Data/Map Sources/City/china.json"
china_shp = gpd.read_file(fp_chn, driver="GeoJSON")
china_shp = china_shp.to_crs(epsg=3395)
china_case = china_case.to_crs(epsg=3395)
hhy_gdf.crs = from_epsg(3395)
po1 = china_case.loc[china_case["name"] == "黑河市"].centroid.iloc[0]
po2 = china_case.loc[china_case["name"] == "保山市"].centroid.iloc[0]
hhy = LineString([po1, po2])
hhy_gdf = gpd.GeoDataFrame(geometry=[hhy, hhy])
fig = china_shp.plot(linewidths=2.5, edgecolor="black", figsize=[14, 14])
china_case.plot(ax=fig, column="case", legend=True, cmap="Oranges", scheme="userdefined", legend_kwds={'loc': 3},
classification_kwds={"bins" : [0, 1, 5, 10, 20, 40, 60, 100, 200, 2000]})
hhy_gdf.plot(ax=fig)
for x, y, label in zip([po1.x, po2.x], [po1.y, po2.y], ["黑河", "腾冲"]):
fig.annotate(label, xy=(x, y), xytext=(1, 1), textcoords="offset pixels")
plt.title("全国市级层面新型冠状病毒肺炎确诊病例 \n (截至 2020-01-29 11:45)")