library(ggplot2)
library(dplyr)
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
library(ggplot2)
library(dplyr)
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
$dose<- as.factor(ToothGrowth$dose)
ToothGrowthggplot(ToothGrowth,aes(x=dose, y=len, color=supp))+
geom_dotplot(
position = position_dodge(width = 0.7),
binwidth = 1.6,
binaxis = "y",
stackdir = "center",
dotsize = 0.8,
width = 0.9
+
)labs(
title = "Dot Plot of Tooth Length by Dose and Supplement Type",
x="Dose (mg/day)",
y="Tooth Length",
color="Supplement Type"
+
)theme_minimal()