library(ggplot2) #library in use
ToothGrowth$dose <- as.factor(ToothGrowth$dose) #making dose a factor
ggplot(ToothGrowth,aes(x=dose,y=len,color=supp))+
geom_dotplot(
binaxis="y", #plot dots in y axis
stackdir = "center", #places dots in the center
position = position_dodge(width=0.8),
dotsize=0.6,
binwidth=1.5 #vertical space dots
)+
labs(
title = "Tooth Growth",
x="doses",
y="tooth len",
color="Type"
) +
theme_minimal() #used for better visual representation