Reputation: 1389
I have data in the following format in a text file:
#Position Mean Median Lower_Quartile Upper_Quartile 10th_Percentile 90th_Percentile
1 33.79097948291701 34.0 34.0 34.0 34.0 34.0
2 33.79898508246205 34.0 34.0 34.0 34.0 34.0
3 33.81967715123146 34.0 34.0 34.0 34.0 34.0
4 33.821820727065926 34.0 34.0 34.0 34.0 34.0
5 33.82225819152194 34.0 34.0 34.0 34.0 34.0
6 37.62032459862636 38.0 38.0 38.0 38.0 38.0
7 37.61853099435671 38.0 38.0 38.0 38.0 38.0
8 37.574522070081805 38.0 38.0 38.0 38.0 38.0
9 37.54608688044097 38.0 38.0 38.0 37.0 38.0
Each row is used to generate a boxplot. I want to generate a graph that shows boxplots from all the rows from above table in one graph,ordered by the position. The default boxplot option loads each column into a boxplot. How to change that?
My initial approaches where using the default boxplot command,yielding me with boxplot for each column.
Upvotes: 0
Views: 59
Reputation: 54237
Given df
contains your data, you could try
library(ggplot2)
ggplot(df, aes(as.factor(Position))) +
geom_boxplot(aes(ymin = X10th_Percentile, lower = Lower_Quartile, middle = Median, upper = Upper_Quartile, ymax =X90th_Percentile), stat = "identity")
Upvotes: 1