import seaborn as sns titanic = sns.load_dataset("titanic") sns.countplot(y="deck", hue="class", data=titanic, palette="Greens_d", order=titanic.deck.value_counts().iloc[:3].index)