I tried doing this but it didn't help
p <- ggplot(data = df, aes(x = Name, y = prop, fill = Name)) +
geom_bar(stat = "identity") +
labs(x = "", y = "EQTL / gene") +
scale_fill_brewer(palette="Greens",name = "Number of cis EQTL") +
theme_classic()+
theme(panel.grid.major.x = element_line(size = 0.1, color = "grey"),
panel.grid.major.y = element_blank(),
panel.grid.minor = element_blank()
)
p+geom_path(x=c(1,1,2,2),y=c(0.85,0.86,0.86,0.85))+
annotate("text",x=1.5,y=1.2,label="p = 2e-16")
I am getting:
Error in annotate("text", x = 1.5, y = 1.2, label = "p = 2e-16") :
unused arguments (x = 1.5, y = 1.2, label = "p = 2e-16")
On Thu, Jan 16, 2020 at 2:51 PM Ana Marija <sokovic.anamarija at gmail.com> wrote:
Hello, I have a code like this: p <- ggplot(data = df, aes(x = Name, y = prop, fill = Name)) + geom_bar(stat = "identity") + labs(x = "", y = "EQTL / gene") + scale_fill_brewer(palette="Greens",name = "Number of cis EQTL") + theme(legend.position = "none") p which produces the attached plot. How do I add a horizontal lines in between middle points of two bars above which I would have written: p = 2e-16 I tried adding this:
p+ annotate("text", x = 1.5, y = 1.2, label = "p = 2e-16", size = 3.5) +
+ annotate("rect", xmin = 1, xmax = 2, ymin = 1, ymax =1,
alpha=0.3,colour = "black")
Error in annotate("text", x = 1.5, y = 1.2, label = "p = 2e-16", size = 3.5) :
unused arguments (x = 1.5, y = 1.2, label = "p = 2e-16", size = 3.5)
Also how do I decrease size of these two bars?
Thanks
Ana