Skip to content

Instantly share code, notes, and snippets.

@austinbrian
Last active October 31, 2018 20:53
Show Gist options
  • Save austinbrian/79301f1c94984aad3398fe6827266c4c to your computer and use it in GitHub Desktop.
Save austinbrian/79301f1c94984aad3398fe6827266c4c to your computer and use it in GitHub Desktop.
If you have a matplotlib axis named "ax", this formats tick marks to put commas in
# from https://stackoverflow.com/a/44444489/7471215
# puts commas in integers
ax.set_yticklabels(['{:,}'.format(int(x)) for x in ax.get_yticks().tolist()])
# formats percentages
ax.set_yticklabels(['{:.0%}'.format(x) for x in ax.get_yticks().tolist()])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment