Hi, I would like to plot some extra text in my plot. This should be a two line text including a special character (sigma). I tried so far a to use expression in combination with paste and "\n"... but I can't get the line break... Here what I've done so far: plot(1,type="n", xaxt='n', yaxt='n', ann=FALSE) text(1,1,labels=expression(paste(sigma,"\n (log scale, m)")),cex = 2) Maybe someone knows how I can achieve that... cheers, /johannes [[alternative HTML version deleted]]
try this: plot(1,type="n", xaxt='n', yaxt='n', ann=FALSE) text(1,1,labels=expression(atop(sigma, "log scale,m")),cex = 2) On Fri, May 11, 2012 at 1:40 PM, Johannes Radinger <jradinger at gmx.at> wrote:> Hi, > > I would like to plot some extra text in my plot. > This should be a two line text including a special character (sigma). > I tried so far a to use expression in combination with paste and "\n"... > but I can't get the line break... > > Here what I've done so far: > > plot(1,type="n", xaxt='n', yaxt='n', ann=FALSE) > text(1,1,labels=expression(paste(sigma,"\n (log scale, m)")),cex = 2) > > Maybe someone knows how I can achieve that... > > > cheers, > > /johannes > > > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.-- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it.
Try this: plot(1,type="n", xaxt='n', yaxt='n', ann=FALSE) text(1,1,labels=expression(atop(sigma,"(log scale, m)")),cex = 2) You can add extra blank characters to align the text like this: plot(1,type="n", xaxt='n', yaxt='n', ann=FALSE) text(1,1,labels=expression(atop(sigma,phantom("WWWWW")~"(log scale, m)")),cex = 2) I would not be surprised if there are more elegant ways to do it, though. Cheers, Bert On Fri, May 11, 2012 at 10:40 AM, Johannes Radinger <jradinger at gmx.at> wrote:> Hi, > > I would like to plot some extra text in my plot. > This should be a two line text including a special character (sigma). > I tried so far a to use expression in combination with paste and "\n"... > but I can't get the line break... > > Here what I've done so far: > > plot(1,type="n", xaxt='n', yaxt='n', ann=FALSE) > text(1,1,labels=expression(paste(sigma,"\n (log scale, m)")),cex = 2) > > Maybe someone knows how I can achieve that... > > > cheers, > > /johannes > > > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.-- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm