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
ToothGrowth$dose <- as.factor(ToothGrowth$dose)ggplot(ToothGrowth, aes(x = dose, y = len, color = supp)) +
geom_dotplot(
binaxis = 'y',
stackdir = 'center',
position = position_dodge(width = 0.8),
dotsize = 0.6,
binwidth = 1.5
) +
labs(
title = "Dot Plot of Tooth Length by Dose and Supplement Type",
x = "Dose (mg/day)",
y = "Tooth Length",
color = "Supplement Type"
) +
theme_minimal()