I managed to make a data like this
df<- structure(list(label = structure(c(2L, 2L, 2L, 1L, 1L, 1L, 2L,
2L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L), .Label = c("boys",
"girls"), class = "factor"), variable = structure(c(1L, 1L, 1L,
1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 5L, 2L, 2L, 2L, 2L, 2L, 4L, 4L,
4L), .Label = c(" G1", " G20", " G5", " G52", " G9"), class = "factor"),
value = structure(c(3L, 8L, 18L, 1L, 15L, 17L, 19L, 7L, 2L,
2L, 11L, 10L, 6L, 4L, 9L, 12L, 14L, 5L, 13L, 16L), .Label = c("112864.443",
"11319531", "12874.443", "142983324", "1612410048", "16349475.63",
"184901841", "2223793.8", "30553282.01", "312004.547", "3135868.44",
"317403612.9", "3686081.063", "43701608", "623793.8", "64959501.42",
"67666215", "767666215", "775987137.8"), class = "factor")), .Names = c("label",
"variable", "value"), class = "data.frame", row.names = c(NA,
-20L))
Now I am trying to make a box plot for each set
when I do this
ggplot(data = df, aes(x=variable, y=value)) + geom_boxplot(aes(fill=label))
it only gives me the following which means it plots all data separated
what I want is to have them together as a box together. These are all G1 which means they will be box together (girls in one color and boys in another color) x axis become 1 . in this set, girls have 3 replicate (samp1,2 and 3) and boys have 3 replicate (samp4,5,6)
Then the second box will be In this case girls have 3 replicate (samp1,2,3) and boys have 2 replicate (samp5,6)
something like this would also be great if few points cannot be plotted by box plot https://www.r-graph-gallery.com/47-groups-distribution-with-ggplot2/
I want to make a significant comparison between girls in different x axis and boys in different x-axis , something like this Put stars on ggplot barplots and boxplots - to indicate the level of significance (p-value)