geom_col
using TidierPlots
using TidierData
using DataFrames
using PalmerPenguins
penguins = dropmissing(DataFrame(PalmerPenguins.load()));
df = @chain penguins begin
@group_by(species, sex)
@summarize(mean_bill_length_mm = mean(bill_length_mm))
@ungroup()
end
6×3 DataFrame
Row | species | sex | mean_bill_length_mm |
---|---|---|---|
String15 | String7 | Float64 | |
1 | Adelie | male | 40.3904 |
2 | Adelie | female | 37.2575 |
3 | Gentoo | female | 45.5638 |
4 | Gentoo | male | 49.4738 |
5 | Chinstrap | female | 46.5735 |
6 | Chinstrap | male | 51.0941 |
ggplot(df, @aes(x = species, y = mean_bill_length_mm)) +
geom_col()
dodge using the group and position arguments
ggplot(df, @aes(x = species, y = mean_bill_length_mm, group = sex)) +
geom_col(position="dodge")
dodge using the dodge aesthetic
ggplot(df, @aes(x = species, y = mean_bill_length_mm, dodge = sex)) +
geom_col()
color based on grouping variable
ggplot(df, @aes(x = species, y = mean_bill_length_mm, color = sex)) +
geom_col()
This page was generated using Literate.jl.