Skip to content

Instantly share code, notes, and snippets.

@cereniyim
Last active October 15, 2019 13:40
Show Gist options
  • Save cereniyim/90bc4e7114a1899d2b6fed6f817a496b to your computer and use it in GitHub Desktop.
Save cereniyim/90bc4e7114a1899d2b6fed6f817a496b to your computer and use it in GitHub Desktop.
Histogram with 5 bins
# set the plot
plt.hist(df.life_expectancy,
range=(df.life_expectancy.min(), df.life_expectancy.max()+1),
bins=5,
alpha=0.5)
# set title, legends and labels and xticks
plt.xlabel("Life Expectancy")
plt.ylabel("Count")
plt.title("Histogram of Life Expectancy between 1952 and 2007 in the World")
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment