GFDRR / CCDR-tools

Geoanalytics for climate and disaster risk screening
https://gfdrr.github.io/CCDR-tools/
12 stars 8 forks source link

Preview to show custom color scale? #3

Closed ConnectedSystems closed 2 years ago

ConnectedSystems commented 2 years ago

When viewing the result preview the color scale may be misleading due to outliers.

Suggest using a logarithmic colormap instead:

With absolute values:

image

With a custom color map that maps colors to minimum value, 0.1 quantile, 0.25 quantile, 0.5 quantile and maximum:

image

Although the color bar needs to be fixed up as the bin values at the lower end get squashed together:

image
matamadio commented 2 years ago

I don't agree on showing EAI% as it could be very misleading; I verified that the numbers shown are correct, that one ADM unit has much more people exposed than elsewhere; so it should pop out. But I agree on better legend classification based on quantile to avoid flattening all other values.

Could you please increase height of the output line a bit? Scrollbar is there but yeah:

immagine

Note also how dropdowns squash the labels: immagine

ConnectedSystems commented 2 years ago

I don't agree on showing EAI% as it could be very misleading; I verified that the numbers shown are correct, that one ADM unit has much more people exposed than elsewhere; so it should pop out.

Yes sorry, I realised this while typing it up but forgot to update the issue title. This issue is on using a non-linear color scale, not changing the data being presented.

Could you click on the cell (blank area to the left) to expand the display? That should solve your first issue. I'll look into the second soon.

matamadio commented 2 years ago

It seems it is something that can be somehow improved by using normalisation:

from matplotlib import colors
divnorm=colors.TwoSlopeNorm(vmin=-5., vcenter=0., vmax=10)
pcolormesh(your_data, cmap="coolwarm", norm=divnorm)

https://matplotlib.org/stable/tutorials/colors/colormapnorms.html

https://stackoverflow.com/questions/7404116/defining-the-midpoint-of-a-colormap-in-matplotlib