Created
August 31, 2018 18:06
-
-
Save mnguyenngo/42c058e1ad48b98bb9b0eeb03adbd163 to your computer and use it in GitHub Desktop.
Center histogram bars on corresponding x-label when plotting from Pandas dataframes
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
# set bins to the (number of bins + 1) - 0.5 to center the bar on the right x-label | |
df['col_name'].hist(xrot=90, figsize=(12,6), rwidth=0.5, bins=np.arange(9)-0.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment