I'm trying to add a grouped boxplot into a boxplot with only one group. I already made it, but the problem is that I can't give a name to the boxplot that has only one group. It is simply not shown. The arguments "name" and "names" don't seem to work when your boxplot does not have different groups.
boxplot(Daten$NV,
boxwex = 0.6, at = 1:1 - 0.2,col = "yellow",
name = "Gesamtstichprobe",
main = "Guinea Pigs' Tooth Growth",
xlab = "Vitamin C dose mg",
ylab = "tooth length",
xlim = c(0.5, 3.5), ylim = c(0, 7), yaxs = "i")
boxplot(Daten$NV ~ Daten$CVKGruppe, add = TRUE,
boxwex = 0.3, at = 1:3 + 0.3, col = "orange")
You could do:
boxplot( Daten$NV,
boxwex = 0.6, at = 1:1 - 0.2, col = "yellow",
name = "Gesamtstichprobe",
main = "Guinea Pigs' Tooth Growth",
xlab = "Vitamin C dose mg",
ylab = "tooth length",
xlim = c(0.5, 3.5), ylim = c(0, 7), yaxs = "i", xaxt = "n")
axis(1, at = 0.8, labels = "Total")
boxplot(Daten$NV ~ Daten$CVKGruppe, add = TRUE,
boxwex = 0.3, at = 1:3 + 0.3, col = "orange")
Created on 2022-04-26 by the reprex package (v2.0.1)
Data
set.seed(1)
Daten <- data.frame(NV = rnorm(150, 4, 1),
CVKGruppe = rep(c("Kamera aus", "Kamera ein_VH an", "Kamera eien_VH aus"),
each = 50))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.