Using the mpg data in R, I can make a boxplot of 'displ' with
boxplot(mpg$displ)
But when I try to make this simple boxplot with ggplot,
ggplot(data = mpg, aes(displ)) + geom_boxplot()
I get this error;
Error in seq.default(from = best$lmin, to = best$lmax, by = best$lstep) : 'from' must be of length 1
In addition: Warning messages:
1: Continuous x aesthetic -- did you forget aes(group=...)?
2: In is.na(data$y) : is.na() applied to non-(list or vector) of type 'NULL'
ggplot2 requires both an x and y variable of a boxplot. Here is how to make a single boxplot
ggplot(data = mpg, aes(x = "", y = displ)) +
geom_boxplot() +
theme(axis.title.x = element_blank())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With