lundi 19 avril 2021

Adding hatches or patterns to ggplot bars

Suppose I want to show in a barplot the gene expression results (logFC) based on RNA-seq and q-PCR analysis. Here is my command line:

library(ggplot2)
f1<- read.csv("PCR_RNA-seq_ex.csv")
p=ggplot(f1, aes(x=geneID, y=logfc, fill= comp,color=exp))+
  geom_bar(stat="identity", position =position_dodge2(preserve="single"))+
  theme(axis.text.x = element_text(angle = 45, vjust = 0.5, hjust=1))`

I have this output:

enter image description here

However I want to get some any mark pattern or hatches on the bars corresponding to one of the variables (exp or comp) like in this plot:

enter image description here

Any help please?

Aucun commentaire:

Enregistrer un commentaire