File: scatterplot_categorical.py

package info (click to toggle)
seaborn 0.13.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,608 kB
  • sloc: python: 37,241; makefile: 182; javascript: 45; sh: 15
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="")