Issue
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:
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!
Solution
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')
Answered By - Li Yupeng
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.