1

Problem

I am planning to publish an article about 'how many votes are counted in each region' every one hour after the June election in Korea is over at 6 p.m. So at 7 p.m., at 8 p.m., at 9 p.m., and so on, I am going to publish an article with this infogram below. Plus, the stronger the color, the bigger percentage of total poll is counted.

enter image description here

So in my code below, the column 'ESRI_PK' will change every one hour, to be more precise will go up, since people will count more votes. (here, ESRI_PK plays the role of the 'vote counting rate', even though in reality it isn't.)

What I would like to do is to show how many votes are counted cumulatively as time passes by. However, the scenario on the left hand side('As-is') illustrates what my current code is doing. Even though the cumulative vote counting rate goes up, the region A has always the lightest color because out of the 3 regions, the A region has the lowest counting rate.

I wish my code would follow the scenario on the right hand side('To-be')! Unfortunately though, the current plotting method will only do the left hand side.

My code

import geopandas as gpd
import matplotlib.pyplot as plt

plt.xkcd()
seoul=gpd.read_file('../json/seoul_municipalities_geo.json')
# You can download the same file from the Github below
# https://github.com/southkorea/seoul-maps/tree/master/juso/2015/json

final_pic=data_result.plot(figsize=(14,10),linewidth=0.25, edgecolor='black', column='ESRI_PK',cmap='Blues',scheme='quantiles',legend=True)
for index,row in seoul.iterrows():
    xy=row['geometry'].centroid.coords[:]
    xytext=row['geometry'].centroid.coords[:]
    plt.annotate(row['SIG_ENG_NM'],xy=xy[0], xytext=xytext[0],  horizontalalignment='center',verticalalignment='center')
    plt.axis('off')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.