python - kilo (K) and mega (M) suffixes on matplotlib's axes -


i print values on axes not 30000 or 7000000 30k or 7m. means add k (kilo) suffix x < 10^6 , m (mega) suffix x >= 10^6. how can that?

current code snippet:

ax = pylab.gca() formatter = matplotlib.ticker.formatstrformatter('%.f') ax.xaxis.set_major_formatter(formatter) 

you need write own function applies suffixes various conditions , use funcformatter instead of strformatter. this example should cover you.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -