using PalmerPenguins, DataFrames
using AlgebraOfGraphics, CairoMakie
import AlgebraOfGraphics.density
using TidierData, TidierPlots
using Pipe: @pipe
= (width = 1000, height = 600) axis
(width = 1000, height = 600)
using PalmerPenguins, DataFrames
using AlgebraOfGraphics, CairoMakie
import AlgebraOfGraphics.density
using TidierData, TidierPlots
using Pipe: @pipe
= (width = 1000, height = 600) axis
(width = 1000, height = 600)
= dropmissing(DataFrame(PalmerPenguins.load()))
penguins first(penguins, 6)
Row | species | island | bill_length_mm | bill_depth_mm | flipper_length_mm | body_mass_g | sex |
---|---|---|---|---|---|---|---|
String15 | String15 | Float64 | Float64 | Int64 | Int64 | String7 | |
1 | Adelie | Torgersen | 39.1 | 18.7 | 181 | 3750 | male |
2 | Adelie | Torgersen | 39.5 | 17.4 | 186 | 3800 | female |
3 | Adelie | Torgersen | 40.3 | 18.0 | 195 | 3250 | female |
4 | Adelie | Torgersen | 36.7 | 19.3 | 193 | 3450 | female |
5 | Adelie | Torgersen | 39.3 | 20.6 | 190 | 3650 | male |
6 | Adelie | Torgersen | 38.9 | 17.8 | 181 | 3625 | female |
describe(penguins)
Row | variable | mean | min | median | max | nmissing | eltype |
---|---|---|---|---|---|---|---|
Symbol | Union… | Any | Union… | Any | Int64 | DataType | |
1 | species | Adelie | Gentoo | 0 | String15 | ||
2 | island | Biscoe | Torgersen | 0 | String15 | ||
3 | bill_length_mm | 43.9928 | 32.1 | 44.5 | 59.6 | 0 | Float64 |
4 | bill_depth_mm | 17.1649 | 13.1 | 17.3 | 21.5 | 0 | Float64 |
5 | flipper_length_mm | 200.967 | 172 | 197.0 | 231 | 0 | Int64 |
6 | body_mass_g | 4207.06 | 2700 | 4050.0 | 6300 | 0 | Int64 |
7 | sex | female | male | 0 | String7 |
= data(penguins) *
pp mapping(:flipper_length_mm, :body_mass_g)
draw(pp; axis = axis)
@ggplot(data = penguins) +
@geom_point(aes(x = flipper_length_mm, y = body_mass_g));
= pp * mapping(color = :species)
pp2 draw(pp2; axis = axis)
@ggplot(
penguins,aes(x = flipper_length_mm, y = body_mass_g, color = species)
+
) @geom_point();
= linear() + mapping()
layers = pp * layers * mapping(color = :species)
pp2 draw(pp2; axis = axis)
@ggplot(
penguins,aes(x = flipper_length_mm, y = body_mass_g, color = species)
+
) @geom_point() +
@geom_smooth(method = "lm");
= pp *
pp2 mapping(color = :species) +
* linear()
pp draw(pp2; axis = axis)
@ggplot(
penguins,aes(x = flipper_length_mm, y = body_mass_g)
+
) @geom_point(aes(color = species)) +
@geom_smooth(method = "lm");
= pp *
pp2 mapping(color = :species, marker = :species) +
* linear()
pp draw(pp2; axis = axis)
@ggplot(
penguins,aes(x = flipper_length_mm, y = body_mass_g)
+
) @geom_point(aes(color = species, shape = species)) +
@geom_smooth(method = "lm");
= pp *
pp2 mapping(color = :species, marker = :species) +
* linear()
pp draw(pp2; axis = axis)
@ggplot(
penguins,aes(x = flipper_length_mm, y = body_mass_g)
+
) @geom_point(aes(color = species, shape = species)) +
@geom_smooth(method = "lm") +
@labs(
= "Body mass and flipper length",
title = "Dimensions for Adelie, Chinstrap, and Gentoo Penguins",
subtitle = "Flipper length (mm)", y = "Body mass (g)",
x = "Species", shape = "Species"
color );
= data(penguins) * frequency() * mapping(:species)
pp draw(pp; axis = axis)
@ggplot(penguins, aes(x = species)) +
@geom_bar();
= data(penguins) * density() * mapping(:body_mass_g)
pp draw(pp; axis = axis)
= data(penguins) * mapping(:species, :body_mass_g) * visual(BoxPlot)
pp draw(pp; axis = axis)
@ggplot(penguins, aes(x = species, y = body_mass_g)) +
@geom_boxplot();
= data(penguins) * mapping(:body_mass_g, color = :species) * density()
pp draw(pp; axis = axis)
# Not available yet.
= data(penguins) * mapping(:body_mass_g, color = :species) * density() * visual(alpha = 0.5)
pp draw(pp; axis = axis)
# Not available yet.
= data(penguins) *
pp mapping(:island, color = :species, stack = :species) *
frequency()
draw(pp; axis = axis)
@ggplot(penguins, aes(x = island, fill = species)) +
@geom_bar();
= data(penguins) * mapping(:flipper_length_mm, :body_mass_g)
pp draw(pp; axis = axis)
@ggplot(penguins, aes(x = flipper_length_mm, y = body_mass_g)) +
@geom_point();
= data(penguins) *
pp mapping(:flipper_length_mm, :body_mass_g
= :species, marker = :island)
, color draw(pp; axis = axis)
@ggplot(penguins, aes(x = flipper_length_mm, y = body_mass_g)) +
@geom_point(aes(color = species, shape = island));
= data(penguins) *
pp mapping(:flipper_length_mm, :body_mass_g
= :species, marker = :species
, color = :island)
, col draw(pp; axis = axis)
# Not available yet.