How can I determine which numbers I would like to display on a colormap?
E.g. GeoPandas automatically displays 0.2*10^9, 0.4*10^9, 0.6*10^9 ... and so on. What if I just want to display 0, 500,000,000 and1,000,000,000 at the correct position?
import geopandas as gpd
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world.plot(column='pop_est', legend=True)

You can use the parameter legend_kwds and pass the desired ticks as a list.
import matplotlib.pyplot as plt
import geopandas as gpd
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world.plot(
column='pop_est',
legend=True,
legend_kwds={'ticks': [0,500000000,1000000000]}
)
plt.show()

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With