Hello help, I have changed around some graphing code and made it into a function. Previously they y label of the axis was inserted as text in its own layout box. text(1,1, expression(~degree~C),cex=1) This worked great and resulted in the symbol for degree. In the function, I have changed it so: text(1,1,paste(b_unit),cex=1) and b_unit<-expression(~degree~C) This now inserts ~degree~C instead of the symbol. Any advice? Thanks, Daisy -- Daisy Englert Duursma Room E8C156 Dept. Biological Sciences Macquarie University? NSW? 2109 Australia
Hi Daisy, Try it without paste():> plot(1, col = 'white') > text(1,1, b_unit,cex=1)HTH, Jorge On Tue, Aug 24, 2010 at 10:45 PM, Daisy Englert Duursma <> wrote:> Hello help, > > I have changed around some graphing code and made it into a function. > Previously they y label of the axis was inserted as text in its own > layout box. > > text(1,1, expression(~degree~C),cex=1) > > This worked great and resulted in the symbol for degree. > > In the function, I have changed it so: > > text(1,1,paste(b_unit),cex=1) > > and > > b_unit<-expression(~degree~C) > > This now inserts ~degree~C instead of the symbol. > > > Any advice? > > Thanks, > Daisy > > > > -- > Daisy Englert Duursma > > Room E8C156 > Dept. Biological Sciences > Macquarie University NSW 2109 > Australia > > ______________________________________________ > R-help@r-project.org mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
On Tue, Aug 24, 2010 at 10:45 PM, Daisy Englert Duursma <daisy.duursma at gmail.com> wrote:> Hello help, > > I have changed around some graphing code and made it into a function. > Previously they y label of the axis was inserted as text in its own > layout box. > > text(1,1, expression(~degree~C),cex=1) > > This worked great and resulted in the symbol for degree. > > In the function, I have changed it so: > > text(1,1,paste(b_unit),cex=1) > > and > > b_unit<-expression(~degree~C) > > This now inserts ~degree~C instead of the symbol. > >Get rid of the paste: plot(1) text(1, 1, b_unit) Actually, if you are going to specify these as formulas anyways you can also get rid of "expression".and possibly the first ~ depending on what you want: plot(0, main = degree ~ C) e <- degree ~ C plot(0, main = e)
On Aug 24, 2010, at 10:45 PM, Daisy Englert Duursma wrote:> Hello help, > > I have changed around some graphing code and made it into a function. > Previously they y label of the axis was inserted as text in its own > layout box. > > text(1,1, expression(~degree~C),cex=1) > > This worked great and resulted in the symbol for degree. > > In the function, I have changed it so: > > text(1,1,paste(b_unit),cex=1) > > and > > b_unit<-expression(~degree~C)With the other suggestions regarding dropping paste ... it would look better as: b_unit<-expression(~degree*C) # imo, of course> > This now inserts ~degree~C instead of the symbol. > > > Any advice?Well, you asked of "any" advice. -- David Winsemius, MD West Hartford, CT
Thanks for the advice, problem solved. -daisy On Wed, Aug 25, 2010 at 1:35 PM, David Winsemius <dwinsemius at comcast.net> wrote:> > On Aug 24, 2010, at 10:45 PM, Daisy Englert Duursma wrote: > >> Hello help, >> >> I have changed around some graphing code and made it into a function. >> Previously they y label of the axis was inserted as text in its own >> layout box. >> >> text(1,1, expression(~degree~C),cex=1) >> >> This worked great and resulted in the symbol for degree. >> >> In the function, I have changed it so: >> >> text(1,1,paste(b_unit),cex=1) >> >> and >> >> b_unit<-expression(~degree~C) > > With the other suggestions regarding dropping paste ... it would look better > as: > > b_unit<-expression(~degree*C) # imo, of course > >> >> This now inserts ~degree~C instead of the symbol. >> >> >> Any advice? > > Well, you asked of "any" advice. > > -- > > David Winsemius, MD > West Hartford, CT > >-- Daisy Englert Duursma Room E8C156 Dept. Biological Sciences Macquarie University? NSW? 2109 Australia Tel +61 2 9850 9256 10A Carrington Rd Hornsby, NSW 2077 Mobile: 0421858456