[R] Error in annotate

Ana Marija @okov|c@@n@m@r|j@ @end|ng |rom gm@||@com
Thu Jan 16 19:01:45 CET 2020


Hello,

my code used to work and now I am getting this error which does not
display my annotation

df <- data.frame("prop" = c(102.73,260.65), "Name" = c("All Genes \n
31385","Glucose Response Genes \n 103"))

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",
labels = c("3124345", "26846")) +
  theme_minimal() +
  theme(legend.position = "right",
        panel.grid.major.y = element_blank(),
        panel.grid.minor.y = element_blank(),
        axis.line = element_line(),
        axis.ticks = element_line())

p + annotate("text", x = 1.5, y = 280, label = "p = 0.008", size = 3.5) +
  annotate("rect", xmin = 1, xmax = 2, ymin = 270, ymax =270,
alpha=0.3,colour = "black")

I am getting this error:

> p + annotate("text", x = 1.5, y = 280, label = "p = 0.008", size = 3.5) +
+   annotate("rect", xmin = 1, xmax = 2, ymin = 270, ymax =270,
alpha=0.3,colour = "black")
Error in annotate("text", x = 1.5, y = 280, label = "p = 0.008", size = 3.5) :
  unused arguments (x = 1.5, y = 280, label = "p = 0.008", size = 3.5)

Please advice,
Ana



More information about the R-help mailing list