Skip to content Skip to sidebar Skip to footer

Seaborn Factorplot

I am trying to create a factor plot but I am not able to change the kind of it from point to bar. How do we do that? The codes used are import numpy as np import matplotlib.pyplo

Solution 1:

The seaborn documentation has the exact example you are looking for. Following the documentation, if you run the below lines, it should generate the bar plot shown.

bar plot generated from the code

import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline

titanic = sns.load_dataset("titanic")
exercise = sns.load_dataset("exercise")
g = sns.catplot("alive", col="deck", 
                col_wrap=3, data=titanic[titanic.deck.notnull()], 
                kind="count", height=2.5, aspect=.8)

The important argument to note here is kind="count".

Post a Comment for "Seaborn Factorplot"