Hi,
I have eleven (11) different farm inputs with a calculated range. Apart from these, mean and standard deviation (SD) is also computed.
I want to draw box plot for each input.
e.g, Input 1
X : 5.8-7.8 (Range), mean: 6.13 and SD = 0.75.
a box-and-whiskers plot have a well defined five-number summary of your data so in general one should not change the meaning of the box and the whiskers. So by definition a boxplot shows the median not the mean!
In general, you can plot a boxplot in ggplot2 like this:
Created on 2020-08-20 by the reprex package (v0.3.0)
(since you did not provide any data or code using an in-build dataset)
What you can do to highlight also the average and the standard deviation is adding that on top of your boxplots. In the first example I use stat_summary that by default calculates the mean and standard error and might be a better choice than standard deviation, but decide yourself - no need to precalculate the stats here). Or you can define the summary stats yourself (2nd example):
library(ggplot2)
ggplot(mpg, aes(class, displ)) +
geom_boxplot() +
stat_summary(color = "red")
#> No summary function supplied, defaulting to `mean_se()`