Juan C
Juan C

Reputation: 6132

Change colorbar boundaries in geopandas plot

I'm stuck on something that should be simple, but I couldn't find an answer. I'm trying to plot something, like this:

world['gdp_per_cap'] = world.gdp_md_est / world.pop_est

world.plot(column='gdp_md_est', legend = True)

Which brings this:

enter image description here

But I'd like to change the colorbar (and the color mapping) so it goes from 0 to 3e7. Tried to do it through legend_kwds, read about vmin, vmax and plt.colorbar(), but couldn't find a way to combine that knowledge into custom boundaries/limits for my colorbar. What am i missing?

Thanks!

Upvotes: 1

Views: 1172

Answers (1)

Li Yupeng
Li Yupeng

Reputation: 846

Just add vmax/vmin in the plot. if you want to change the colormap, just pass the name to cmap.

world.plot(column='gdp_md_est', legend = True,vmin = 0.5e7,max=1.75e7,  cmap='Reds')

Upvotes: 2

Related Questions