Hi, I created several figures and their titles should appear like this: Figure 1: Monte Carlo results for alternative estimators of structural parameters (N = 100, T = 5) Because N and T change across figures, my code includes the following lines: N.set <- 100 T.set <- 5 mtext(“Figure 1: Monte Carlo results for alternative estimators of structural parameters",side=3,outer=T,line=4,cex=0.8) mtext(as.expression(substitute(list(N==p1,T==p2),list(p1=N.set[1],p2=T.set[1 ]))),side=3,outer=T,line=2,cex=0.8) However, I do not know how to merge the two last command lines in order to the title appear in a single line. Is it possible to do that? Thanks, José Santos [[alternative HTML version deleted]]
Try ?bquote HTH kd 2012.06.20. 10:36 keltezéssel, Joaquim J.S. Ramalho írta:> Hi, > > > > I created several figures and their titles should appear like this: > > > > Figure 1: Monte Carlo results for alternative estimators of structural > parameters (N = 100, T = 5) > > Because N and T change across figures, my code includes the following lines: > > > > N.set<- 100 > > T.set<- 5 > > mtext(?Figure 1: Monte Carlo results for alternative estimators of > structural parameters",side=3,outer=T,line=4,cex=0.8) > > mtext(as.expression(substitute(list(N==p1,T==p2),list(p1=N.set[1],p2=T.set[1 > ]))),side=3,outer=T,line=2,cex=0.8) > > > > However, I do not know how to merge the two last command lines in order to > the title appear in a single line. Is it possible to do that? > > > > Thanks, > > > > José Santos > > > > > > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]
Thanks. I did not know bquote. This worked immediately: fig.n <- 1 N <- 100 T <- 5 mtext(bquote(paste("Figure ",.(fig.n),": Monte Carlo results for alternative estimators of structural parameters (",N==.(N)," and ",T==.(T),")")),side=3,outer=T,line=4,cex=0.8)> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] > On Behalf Of Kehl D?niel > Sent: Wednesday, June 20, 2012 9:52 AM > To: r-help at r-project.org > Subject: Re: [R] Figure title > > Try > > ?bquote > > HTH > kd > > 2012.06.20. 10:36 keltezissel, Joaquim J.S. Ramalho mrta: > > Hi, > > > > > > > > I created several figures and their titles should appear like this: > > > > > > > > Figure 1: Monte Carlo results for alternative estimators of structural > > parameters (N = 100, T = 5) > > > > Because N and T change across figures, my code includes the following > lines: > > > > > > > > N.set<- 100 > > > > T.set<- 5 > > > > mtext(?Figure 1: Monte Carlo results for alternative estimators of > > structural parameters",side=3,outer=T,line=4,cex=0.8) > > > > mtext(as.expression(substitute(list(N==p1,T==p2),list(p1=N.set[1],p2=T > > .set[1 > > ]))),side=3,outer=T,line=2,cex=0.8) > > > > > > > > However, I do not know how to merge the two last command lines in > > order to the title appear in a single line. Is it possible to do that? > > > > > > > > Thanks, > > > > > > > > Josi Santos > > > > > > > > > > > > > > > > > > [[alternative HTML version deleted]] > > > > > > > > ______________________________________________ > > R-help at r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > [[alternative HTML version deleted]]