Hi all, let me give a simple example: b<-20 I would like to print ylab as "P20" where "P" is printed in Italic font. When I do the following: plot(1, ylab=expression(paste(italic("P"),b,sep=""))) I got y axis label printed as "Pb" instead of "P20". What is the best solution to print platmath symbols with value of the variable at the same time? Thanks John
Try this, b = 20 plot(1, ylab= bquote(italic(P) * .(b)) ) HTH, baptiste On 19 August 2010 20:02, array chip <arrayprofile at yahoo.com> wrote:> Hi all, let me give a simple example: > > b<-20 > I would like to print ylab as "P20" where "P" is printed in Italic font. When I > do the following: > > plot(1, ylab=expression(paste(italic("P"),b,sep=""))) > > I got y axis label printed as "Pb" instead of "P20". What is the best solution > to print platmath symbols with value of the variable at the same time? > > Thanks > > John > > ______________________________________________ > 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. >-- ____________________ Dr. Baptiste Augui? Departamento de Qu?mica F?sica, Universidade de Vigo, Campus Universitario, 36310, Vigo, Spain tel: +34 9868 18617 http://webs.uvigo.es/coloides
On Aug 19, 2010, at 2:02 PM, array chip wrote:> Hi all, let me give a simple example: > > b<-20 > I would like to print ylab as "P20" where "P" is printed in Italic > font. When I > do the following: > > plot(1, ylab=expression(paste(italic("P"),b,sep=""))) > > I got y axis label printed as "Pb" instead of "P20". What is the > best solution > to print platmath symbols with value of the variable at the same time??substitute ?plotmath plot(1, ylab=substitute(list(italic(P)*b), list(b=b) ) ) Or: ?bquote plot(1, ylab=bquote(italic(P)*.(b) ) ) -- David Winsemius, MD West Hartford, CT
Thanks, yes it worked! What about if I want to print as "P2, A" where A is just letter A and 2 is from variable b. John ----- Original Message ---- From: baptiste auguie <baptiste.auguie at googlemail.com> To: array chip <arrayprofile at yahoo.com> Cc: r-help at stat.math.ethz.ch Sent: Thu, August 19, 2010 11:08:10 AM Subject: Re: [R] plotmath question Try this, b = 20 plot(1, ylab= bquote(italic(P) * .(b)) ) HTH, baptiste On 19 August 2010 20:02, array chip <arrayprofile at yahoo.com> wrote:> Hi all, let me give a simple example: > > b<-20 > I would like to print ylab as "P20" where "P" is printed in Italic font. WhenI> do the following: > > plot(1, ylab=expression(paste(italic("P"),b,sep=""))) > > I got y axis label printed as "Pb" instead of "P20". What is the best solution > to print platmath symbols with value of the variable at the same time? > > Thanks > > John > > ______________________________________________ > 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. >-- ____________________ Dr. Baptiste Augui? Departamento de Qu?mica F?sica, Universidade de Vigo, Campus Universitario, 36310, Vigo, Spain tel: +34 9868 18617 http://webs.uvigo.es/coloides ____________________
On Aug 19, 2010, at 2:24 PM, array chip wrote:> Thanks, yes it worked! > > What about if I want to print as "P2, A" where A is just letter A > and 2 is from > variable b.?plotmath plot(1, ylab= bquote(italic(P) *","*.(b)~A) )> John > > > > ----- Original Message ---- > From: baptiste auguie <baptiste.auguie at googlemail.com> > To: array chip <arrayprofile at yahoo.com> > Cc: r-help at stat.math.ethz.ch > Sent: Thu, August 19, 2010 11:08:10 AM > Subject: Re: [R] plotmath question > > Try this, > > b = 20 > > plot(1, ylab= bquote(italic(P) * .(b)) ) > > HTH, > > baptiste > > On 19 August 2010 20:02, array chip <arrayprofile at yahoo.com> wrote: >> Hi all, let me give a simple example: >> >> b<-20 >> I would like to print ylab as "P20" where "P" is printed in Italic >> font. When > I >> do the following: >> >> plot(1, ylab=expression(paste(italic("P"),b,sep=""))) >> >> I got y axis label printed as "Pb" instead of "P20". What is the >> best solution >> to print platmath symbols with value of the variable at the same >> time? >> >> Thanks >> >> John >> >> ______________________________________________ >> 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. >> > > > > -- > ____________________ > > Dr. Baptiste Augui? > > Departamento de Qu?mica F?sica, > Universidade de Vigo, > Campus Universitario, 36310, Vigo, Spain > > tel: +34 9868 18617 > http://webs.uvigo.es/coloides > ____________________ > > > > > > ______________________________________________ > 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.David Winsemius, MD West Hartford, CT
Thanks David! John ----- Original Message ---- From: David Winsemius <dwinsemius at comcast.net> To: array chip <arrayprofile at yahoo.com> Cc: baptiste auguie <baptiste.auguie at googlemail.com>; r-help at stat.math.ethz.ch Sent: Thu, August 19, 2010 11:34:07 AM Subject: Re: [R] plotmath question On Aug 19, 2010, at 2:24 PM, array chip wrote:> Thanks, yes it worked! > > What about if I want to print as "P2, A" where A is just letter A > and 2 is from > variable b.?plotmath plot(1, ylab= bquote(italic(P) *","*.(b)~A) )> John > > > > ----- Original Message ---- > From: baptiste auguie <baptiste.auguie at googlemail.com> > To: array chip <arrayprofile at yahoo.com> > Cc: r-help at stat.math.ethz.ch > Sent: Thu, August 19, 2010 11:08:10 AM > Subject: Re: [R] plotmath question > > Try this, > > b = 20 > > plot(1, ylab= bquote(italic(P) * .(b)) ) > > HTH, > > baptiste > > On 19 August 2010 20:02, array chip <arrayprofile at yahoo.com> wrote: >> Hi all, let me give a simple example: >> >> b<-20 >> I would like to print ylab as "P20" where "P" is printed in Italic >> font. When > I >> do the following: >> >> plot(1, ylab=expression(paste(italic("P"),b,sep=""))) >> >> I got y axis label printed as "Pb" instead of "P20". What is the >> best solution >> to print platmath symbols with value of the variable at the same >> time? >> >> Thanks >> >> John >> >> ______________________________________________ >> 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. >> > > > > -- > ____________________ > > Dr. Baptiste Augui? > > Departamento de Qu?mica F?sica, > Universidade de Vigo, > Campus Universitario, 36310, Vigo, Spain > > tel: +34 9868 18617 > http://webs.uvigo.es/coloides > ____________________ > > > > > > ______________________________________________ > 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.David Winsemius, MD West Hartford, CT