Search code examples
matplotlibseaborndata-sciencedata-analysis

Titanic dataset visualization query


if I want to plot 'bar-graph' having 'Embarked' column on x-axis and number of death-counts on y-axis. How should I do this ?

sns.barplot(x = 'Embarked', y = titanic['Survival'].value_counts(), data = titanic)

my dataframe name is 'titanic'. 'Survival' column has 'dead' and 'alive' values.

but it is giving me empty plot. How should I write the code ?


Solution

  • How about

    sns.countplot(x="Embarked", hue="Survival", data=titanic)
    plt.show()