# NOT RUN {
data(penguins, package = "palmerpenguins")
gf_text(bill_length_mm ~ bill_depth_mm,
data = penguins,
label = ~species, color = ~species, size = 2, angle = 30
)
penguins %>%
gf_point(bill_length_mm ~ bill_depth_mm, color = ~species, alpha = 0.5) %>%
gf_text(bill_length_mm ~ bill_depth_mm,
label = ~species, color = ~species,
size = 2, angle = 0, hjust = 0, nudge_x = 0.1, nudge_y = 0.1
)
if (require(dplyr)) {
data(penguins, package = "palmerpenguins")
penguins_means <-
penguins %>%
group_by(species) %>%
summarise(bill_length_mm = mean(bill_length_mm), bill_depth_mm = mean(bill_depth_mm))
gf_point(bill_length_mm ~ bill_depth_mm, data = penguins, color = ~species) %>%
gf_label(bill_length_mm ~ bill_depth_mm,
data = penguins_means,
label = ~species, color = ~species, size = 2, alpha = 0.7
)
}
# }
Run the code above in your browser using DataLab