Back to Seaborn

Pointplot

doc/_docstrings/pointplot.ipynb

0.13.21.5 KB
Original Source
python
import seaborn as sns
sns.set_theme(style="whitegrid")
penguins = sns.load_dataset("penguins")
flights = sns.load_dataset("flights")
python
sns.pointplot(data=penguins, x="island", y="body_mass_g")
python
sns.pointplot(data=penguins, x="island", y="body_mass_g", hue="sex")
python
sns.pointplot(
    data=penguins,
    x="island", y="body_mass_g", hue="sex",
    markers=["o", "s"], linestyles=["-", "--"],
)
python
sns.pointplot(data=penguins, x="island", y="body_mass_g", errorbar="sd")
python
sns.pointplot(
    data=penguins, x="body_mass_g", y="island",
    errorbar=("pi", 100), capsize=.4,
    color=".5", linestyle="none", marker="D",
)
python
sns.pointplot(data=penguins, x="sex", y="bill_depth_mm", hue="species", dodge=True)
python
sns.stripplot(
    data=penguins, x="species", y="bill_depth_mm", hue="sex",
    dodge=True, alpha=.2, legend=False,
)
sns.pointplot(
    data=penguins, x="species", y="bill_depth_mm", hue="sex",
    dodge=.4, linestyle="none", errorbar=None,
    marker="_", markersize=20, markeredgewidth=3,
)
python
flights_wide = flights.pivot(index="year", columns="month", values="passengers")
sns.pointplot(flights_wide)
python
sns.pointplot(flights_wide["Jun"])
python
sns.pointplot(flights_wide["Jun"], formatter=lambda x: f"'{x % 1900}")
python
ax = sns.pointplot(flights_wide["Jun"], native_scale=True)
ax.plot(1955, 335, marker="*", color="r", markersize=10)