library(ggplot2)Warning: package 'ggplot2' was built under R version 4.5.3
library(ggplot2)Warning: package 'ggplot2' was built under R version 4.5.3
data <- ToothGrowthhead(data) len supp dose
1 4.2 VC 0.5
2 11.5 VC 0.5
3 7.3 VC 0.5
4 5.8 VC 0.5
5 6.4 VC 0.5
6 10.0 VC 0.5
data$supp <- as.factor(data$supp)
data$dose <- as.factor(data$dose)ggplot(data , aes(x = dose, y = len , color = supp)) +
geom_dotplot(
binaxis = "y",
stackdir = "center",
position = position_dodge(width = 0.6))+
labs(
title = "dodplot len by dose",
x = "len",
y= "supp"
) +
theme_minimal() +
theme(legend.position = "top")Bin width defaults to 1/30 of the range of the data. Pick better value with
`binwidth`.