ax.get_xaxis().set_major_formatter(matplotlib.ticker.FuncFormatter(lambda x,
    p: format(int(x), ',')))
ax2.get_xaxis().set_major_formatter(matplotlib.ticker.FuncFormatter(lambda
    x, p: format(int(x), ',')))
fig1.show()
How do I format axis number format to thousands with a comma in matplotlib?