I have a pandas.DataFrame and I want to plot a graph based on two columns: Age (int), Survived (int - 0 or 1). Now I have something like this:
This is the code I use:
class DataAnalyzer:
def _facet_grid(self, func, x: List[str], col: str = None, row: str = None) -> None:
g = sns.FacetGrid(self.train_data, col=col, row=row)
if func == sns.barplot:
g.map(func, *x, ci=None)
else:
g.map(func, *x)
g.add_legend()
plt.show()
def analyze(self) -> None:
# Check if survival rate is connected with Age
self._facet_grid(plt.hist, col='Survived', x=['Age'])
So this is shown on two subplots. This is good, but its harder to see the difference between the amount of records which have 0 vs 1 in the Survived column, for the particular age range.
So I want to have something like this:
In this scenario you could see this difference. Is there some way to do it on seaborn (cuz there I can easily operate on pandas.DataFrame)? I don't want to use vanilla matplotlib if that's possible


