Answers for "seaborn countplot"

0

display values on countplot

plt.figure(figsize=(12,8))
ax = sns.countplot(x="AXLES", data=dfWIM, order=[3,4,5,6,7,8,9,10,11,12])
plt.title('Distribution of Truck Configurations')
plt.xlabel('Number of Axles')
plt.ylabel('Frequency [%]')

for p in ax.patches:
        ax.annotate('%{:.1f}'.format(p.get_height()), (p.get_x()+0.1, p.get_height()+50))
Posted by: Guest on June-30-2020
3

seaborn pairplot

>>> import seaborn as sns; sns.set(style="ticks", color_codes=True)
>>> iris = sns.load_dataset("iris")
>>> g = sns.pairplot(iris)
Posted by: Guest on May-17-2020
0

countplot in pandas

>>> import seaborn as sns
>>> sns.set_theme(style="darkgrid")
>>> titanic = sns.load_dataset("titanic")
>>> ax = sns.countplot(x="class", data=titanic)
Posted by: Guest on December-09-2020
0

seaborn countplot

## for single column
sns.countplot(y=df.col)

## for multiple columns
fig, ax = plt.subplots(1, 3, figsize=(25, 10))
fig.suptitle('Count Plot', fontsize=16, y=0.92)

columns = ['Income', 'Age', 'Purchased']
for i, col in enumerate(columns):
    graph = sns.countplot(y=df[col], ax=ax[i])
    ax[i].set_title(*[col])
    graph.bar_label(graph.containers[0])
Posted by: Guest on October-21-2021
0

countplot for different classes in a column

>>> ax = sns.countplot(x="who", data=titanic, palette="Set3")
Posted by: Guest on September-30-2020

Python Answers by Framework

Browse Popular Code Answers by Language