probably a stupid question. I have a data.frame that looks like:
Sample3 Sample1 Sample4 Sample5 Sample10 Gene1 6.90 6.45 6.56 3.4 2.0 Gene2 3.4 4.98 0.12 1.5 0.56 Gene3 3.24 0 0.12 0.56 0.22 .....................
And another data.frame (Sample_ann) that looks like:
Sample Batch Sample3 A Sample1 A Sample4 B Sample5 C Sample10 C ... ...
I would like to plot Boxplots colouring samples per batch. The point is that ggplot reorder samples but I would like to maintain the order as it is.
here the code:
mydf_reorder %>% rownames_to_column("Genes") %>% gather(Sample, Sample_value, -Genes) %>% left_join(Samples_ann, by = "Sample") %>% ggplot(aes(x=Sample, y=Sample_value, color=Batch)) + geom_boxplot()
I tried to include +geom_bar(stat="identity") but the order is still changed.
Can anyone help me please?
Thank you in advance