Created
March 23, 2018 15:18
-
-
Save WillKoehrsen/58d97c1ecc51354736314b3f5cdef3dc to your computer and use it in GitHub Desktop.
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
# List of five airlines to plot | |
airlines = ['United Air Lines Inc.', 'JetBlue Airways', 'ExpressJet Airlines Inc.'', | |
'Delta Air Lines Inc.', 'American Airlines Inc.'] | |
# Iterate through the five airlines | |
for airline in airlines: | |
# Subset to the airline | |
subset = flights[flights['name'] == airline] | |
# Draw the density plot | |
sns.distplot(subset['arr_delay'], hist = False, kde = True, | |
kde_kws = {'linewidth': 3}, | |
label = airline) | |
# Plot formatting | |
plt.legend(prop={'size': 16}, title = 'Airline') | |
plt.title('Density Plot with Multiple Airlines') | |
plt.xlabel('Delay (min)') | |
plt.ylabel('Density') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
there's a slight typo