Boxplot Axis and Text

Hi, and welcome!

Like R itself, many of us who answer questions here follow the principle of lazy evaluation. That why you should see the FAQ: What's a reproducible example (`reprex`) and how do I create one? The most common problem, even when complete code such as you've provided, is a lack of the data object.

There's a variety of ways to handle this:

  1. dput(your_data) and cut and paste the output
  2. If large, do the same with a sample
  3. gist a csv file
  4. Find a built-in data set that has the same structure

In this case, the iris dataset is parallel.

I'm going to be further lazy and use ggplot2 because it makes the solution easier.


box <- ggplot(data=iris, aes(x=Species, y=Sepal.Length))
box + geom_boxplot(aes(fill=Species)) + 
  ylab("Sepal Length") + ggtitle("Iris Boxplot") +
  stat_summary(fun.y=mean, geom="point", shape=5, size=4) +

Created on 2020-02-11 by the reprex package (v0.3.0)