import pandas as pd
import altair as alt
import seaborn as sns
from matplotlib import pyplot as plt
Data from Palmer Penguins R package
penguins = pd.read_csv("https://pos.it/palmer-penguins-github-csv")
penguins.groupby("species").size().reset_index(name = "count")
sns.displot(penguins,
x = "bill_depth_mm",
hue = "species",
kind = "kde", fill = True,
aspect = 2, height = 3)
plt.show()
sns.displot(penguins,
x = "bill_length_mm",
hue = "species",
kind = "kde", fill = True,
aspect = 2, height = 3)
plt.show()
alt.Chart(penguins).mark_circle(size=60).encode(
alt.X('bill_length_mm',
scale=alt.Scale(zero=False)
),
alt.Y('bill_depth_mm',
scale=alt.Scale(zero=False)
),
color = alt.Color('species', scale = scale),
tooltip=['species', 'sex', 'island']
)