Suppress scientific notation in geopandas plot legend

Viewed 501

I am new to geopandas and am trying to plot a map with a legend in regular notation not scientific notation. I understand I must use the legend_kwds and know about the 'fmt' keyword but I've tried multiple settings to no avail. Here is my current code drawing up the map:

img = geodf.plot(figsize=(16, 16), column='rate', cmap='Reds', legend=True,
                       legend_kwds={'label': "Rate",
                                    'orientation': "horizontal",
                                   'pad': 0.01,
                                   'fmt': '%f'})

enter image description here

How do I suppress scientific notation of the legend?

EDIT: I have tried

img.ticklabel_format(useOffset=False)

This does not solve my issue. The legend is still showing values in 1e6. This is because img refers to the main axes of the plot, not the legend's axes. So that, the mentioned answer is definitely not working for this question.

SOLUTION: @swatchai has provided the solution I was looking for. The legend_kwds to use is 'format':"%.0f", not 'fmt'.

1 Answers

I guess you need to format x-axis :

img.ticklabel_format(useOffset=False)
img.show()
Related