Skip to content

Instantly share code, notes, and snippets.

@WillKoehrsen
Last active October 25, 2023 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save WillKoehrsen/09e8527a5b95682a68ff4eebe1a9e8bb to your computer and use it in GitHub Desktop.
Save WillKoehrsen/09e8527a5b95682a68ff4eebe1a9e8bb to your computer and use it in GitHub Desktop.
# Show 4 different binwidths
for i, binwidth in enumerate([1, 5, 10, 15]):
# Set up the plot
ax = plt.subplot(2, 2, i + 1)
# Draw the plot
ax.hist(flights['arr_delay'], bins = int(180/binwidth),
color = 'blue', edgecolor = 'black')
# Title and labels
ax.set_title('Histogram with Binwidth = %d' % binwidth, size = 30)
ax.set_xlabel('Delay (min)', size = 22)
ax.set_ylabel('Flights', size= 22)
plt.tight_layout()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment