# Plot overlaid histograms for continuous features
for i in ['Age', 'Fare']:
died = list(titanic[titanic['Survived'] == 0][i].dropna())
survived = list(titanic[titanic['Survived'] == 1][i].dropna())
xmin = min(min(died), min(survived))
xmax = max(max(died), max(survived))
width = (xmax - xmin) / 40
sns.distplot(died, color='r', kde=False, bins=np.arange(xmin, xmax, width))
sns.distplot(survived, color='g', kde=False, bins=np.arange(xmin, xmax, width))
plt.legend(['Did not survive', 'Survived'])
plt.title('Overlaid histogram for {}'.format(i))
plt.show()