我有3个使用过的数据:
以下是数据预览: enter image description here
0 Sumatera Utara 7430
1 Jawa Barat 6192
2 Jakarta Raya 4635
3 Banten 2351
4 Jawa Timur 1383
5 Jawa Tengah 840
6 Riau 782
7 Sumatera Selatan 526
8 Sumatera Barat 490
9 Bali 459
10 Lampung 379
11 Aceh 377
12 Kalimantan Timur 266
13 Sulawesi Selatan 241
14 Kepulauan Riau 230
15 Yogyakarta 193
16 Jambi 186
17 Bengkulu 133
18 Sulawesi Utara 109
19 Bangka Belitung 98
20 Kalimantan Barat 81
21 Nusa Tenggara Timur 71
22 Papua 55
23 Sulawesi Tengah 54
24 Kalimantan Utara 37
25 Maluku 37
26 Sulawesi Tenggara 33
27 Kalimantan Tengah 31
28 Kalimantan Selatan 30
29 Nusa Tenggara Barat 21
30 Sulawesi Barat 16
31 Gorontalo 11
32 Papua Barat 10
33 Maluku Utara 8
这是一个省份和计数列表,它表明苏门答腊省是所有省份中计数最多的
但当我绘制它的时候,它显示加里曼丹帖木儿的价值是最黑暗的,而不是苏门答腊
代码如下: [绘图代码2
# set a variable that will call whatever column we want to visualise on the map
values = 'Count'
# set the value range for the choropleth
vmin, vmax = 0,100
# create figure and axes for Matplotlib
fig, ax = plt.subplots(1, figsize=(30, 10))
# remove the axis
ax.axis('off')
# add a title
title = 'Data Persebaran per Provinsi'
ax.set_title(title, fontdict={'fontsize': '25', 'fontweight' : '3'})
# create an annotation for the data source
ax.annotate('Source: Laporan per Juni - November',xy=(0.1, .08), xycoords='figure fraction', horizontalalignment='left', verticalalignment='top', fontsize=12 ,color='#555555')
# norm = mpl.colors.Normalize(vmin=0, vmax=1000)
# Create colorbar as a legend
sm = plt.cm.ScalarMappable(cmap='RdBu', norm=plt.Normalize(vmin=vmin, vmax=vmax))
# add the colorbar to the figure
cbar = fig.colorbar(sm)
# create map
df_join.plot(column=values, cmap='RdBu', linewidth=0.8, ax=ax, edgecolor='0.8', norm=plt.Normalize(vmin=vmin, vmax=vmax))
这是地图: enter image description here
你能帮我看一下并告诉我代码有什么问题吗? 提前谢谢
目前没有回答
相关问题 更多 >
编程相关推荐