annotate a formula (with bqoute or substitute) in R (ggplot) gives Error
问题 I want to add a formula with variables in it as a annotation onto my ggplot. regline1 <- 0.00 slope1 <- 1.00 dat <- as.data.frame(c(0,1)) dat[2] <- c(0,1) names(dat) <- c("foo","bar") p <- ggplot(dat, aes(foo, bar)) + coord_fixed(ratio = 1) + geom_point() + geom_abline(slope = slope1, intercept = intercept1, linetype = "dashed") + labs(x = substitute(y[H1]==i+s%*%x,list(i=format(intercept1, digits = 1), s= format(slope1, digits = 1)))) As you can see it is no problem for ggplot to evaluate