Skip to content

Instantly share code, notes, and snippets.

@mnguyenngo
Created August 31, 2018 18:06
Show Gist options
  • Save mnguyenngo/42c058e1ad48b98bb9b0eeb03adbd163 to your computer and use it in GitHub Desktop.
Save mnguyenngo/42c058e1ad48b98bb9b0eeb03adbd163 to your computer and use it in GitHub Desktop.
Center histogram bars on corresponding x-label when plotting from Pandas dataframes
# 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