Reputation: 426
Consider the dataframe
df = data.frame(x = rnorm(33),cat = gl(3,11))
When I plot a boxplot of x
separated by each level of cat
this is what I get
boxplot(df$x ~ df$cat)
Is it possible to include another box in the same plot showing all the values of x
?
boxplot(df$x,xlab = "x")
Upvotes: 0
Views: 59
Reputation: 6535
boxplot(x ~ cat, data = rbind(df, data.frame(x = df$x, cat = "all")))
Upvotes: 2