I want to plot the boxplot:
library("ggplot2")
p <- ggplot(mpg, aes(class, hwy))
p + geom_boxplot(aes(colour = drv))
but the boxplot showed overlapped within each class.
How can I add distance between boxes?
I want to plot the boxplot:
library("ggplot2")
p <- ggplot(mpg, aes(class, hwy))
p + geom_boxplot(aes(colour = drv))
but the boxplot showed overlapped within each class.
How can I add distance between boxes?
just try following variant
library("ggplot2")
dodge <- position_dodge(width = 0.9)
p <- ggplot(mpg, aes(class, hwy))
p+geom_boxplot(aes(fill = drv),position=dodge)
With position=dodge
you can set the distance between boxplots
Hope this helps
Best
Pavlo