-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
I've been looking at the examples here.
- Seems that box colors represent Human Development Index (HDI), and a numeric color scale indicates HDI numeric value of each box.
- Box areas are proportional to Gross Domestic Product (GDP), but the graph gives no idea of its real value (there are no numeric axes to estimate box areas as their height x width products).
Changing ax.axis('off') to ax.axis('on') we see those numerical scales, but they go from 0 to 100 by default, which is not very realistic:
Ideally, the product of both axis lengths (thus 100 x 100) should be equal to the total summed area of all boxes (which is not 10000 in the example graphs, as US GDP value alone is 15684750).
We cannot use width x height of each box to know the real GDP value for that country.
But we can correct axes x and y upper limits, so their product equals that total area sum of all boxes:
aspect=1.156 # taken from your example
import math
total_area = df['gdp_mil_usd'].sum()
norm_x = math.sqrt(total_area)
norm_y = math.sqrt(total_area)This way we can calculate any box GDP by its area (width x height).
I think this is useful, so there could be an option to autocalculate norm_x and norm_y this way.
Metadata
Metadata
Assignees
Labels
No labels

