I have a dataset (test) as given below:
Type Met1 Met2 Met3 Met4 TypeA 65 43 97 77 TypeA 46 25 76 77 TypeA 44 23 55 46 TypeA 46
A solution with ggplot2.
ggplot2
First, transform your data frame test to the long format using melt:
test
melt
library(reshape2) test.m <- melt(test)
Plot the data:
library(ggplot2) ggplot(test.m, aes(x = variable, y = value, fill = Type)) + geom_boxplot() + scale_fill_manual(values = c("yellow", "orange"))