Penguins

using GLMakie, PalmerPenguins, DataFrames
using AlgebraOfGraphics
GLMakie.activate!()

function getPenguins()
    ENV["DATADEPS_ALWAYS_ACCEPT"] = "true"
    penguins = dropmissing(DataFrame(PalmerPenguins.load()))
    return penguins
end
let
    penguins = getPenguins()
    # declare new plot attributes
    palette = (color=tuple.(["#FC7808", "#8C00EC", "#107A78"], 0.65),
        marker=[:circle, :utriangle, :rect])
    cycle = Cycle([:color, :marker], covary=true)
    # declare the dataset
    p_len  = data(penguins)
    # declare the arguments of the analysis
    p_len *= mapping(:flipper_length_mm => (t -> t / 10) => "flipper length (cm)",
        :bill_length_mm => (t -> t / 10) => "bill length (cm)")
    # declare the grouping and the respective visual attribute
    p_len *= mapping(color=:species, marker=:species)

    with_theme(theme_ggplot2(),resolution = (600,400), palette=palette, Scatter=(cycle=cycle,)) do
        draw(p_len + p_len * linear();
            axis = (; title="Flipper and bill length"))
    end
end

Warning

This example was autogenerated using:

using Pkg
Pkg.status(["CairoMakie", "PalmerPenguins", "DataFrames", "AlgebraOfGraphics"])
Status `~/work/BeautifulMakie/BeautifulMakie/docs/Project.toml`
  [cbdf2221] AlgebraOfGraphics v0.6.16
  [13f3f980] CairoMakie v0.10.6
  [a93c6f00] DataFrames v1.5.0
  [8b842266] PalmerPenguins v0.1.4

This page was generated using Literate.jl.