[R] Using text and variable in ggtitle (ggplot2)
rainer.schuermann at gmx.net
Sat Jul 20 00:58:33 CEST 2013
Not sure whether I understand your question fully but I guess paste() is your friend:
ggtitle( paste( "RR(overall) =", RR, "N =", N, "alpha =", alpha1 ) )
On Friday 19 July 2013 17:17:24 Manisha Brahma chary wrote:
> I am using ggplot2 to plot a graph and I want to give a title to the plot that has both text and variables. I have tried a couple of ways, but none of the methods work. Below is my code. Under ggtitle RR, N, alpha1 are variables and "RR(overall), "N", "alpha" are strings.
> data <- do.call(rbind,result)
> data.new <- as.data.frame(cbind(data$p1,(data$prob),data$r))
> colnames(data.new) <- c("ES","Probability","Vector")
> bp<-(ggplot(data.new,aes(x=ES,y=Probability,group=Vector,colour=factor(Vector))) + geom_line())
> bp.title<- bp+ ggtitle("RR(overall) ="RR, "N" = N, "alpha = "alpha1)
> Any suggestion on ggplot2 will be much appreciated.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
- - - - -
Der NSA keine Chance: e-mail verschluesseln!
More information about the R-help