File: scatterplot_categorical.py

package info (click to toggle)
seaborn 0.11.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,232 kB
  • sloc: python: 25,600; makefile: 185; javascript: 45; sh: 2
file content (16 lines) | stat: -rw-r--r-- 386 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""
Scatterplot with categorical variables
======================================

_thumb: .45, .45

"""
import seaborn as sns
sns.set_theme(style="whitegrid", palette="muted")

# Load the penguins dataset
df = sns.load_dataset("penguins")

# Draw a categorical scatterplot to show each observation
ax = sns.swarmplot(data=df, x="body_mass_g", y="sex", hue="species")
ax.set(ylabel="")