Last active
October 31, 2018 20:53
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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