MichaelJMath
8/10/2017 - 1:10 AM

Format Axis tick labels as percent.

Format Axis tick labels as percent.

import matplotlib as mpl

# Initialize a Percent Formatter for the axis
def to_percent(y, position): 
    return '%3.0f' % (100. * y) + '%'
  
pct_formatter = mpl.ticker.FuncFormatter(to_percent)

plt.gca().yaxis.set_major_formatter(pct_formatter)