[R] text(): combine expression and line break
Bert Gunter
gunter.berton at gene.com
Fri May 11 20:06:45 CEST 2012
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
> 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.
--
Bert Gunter
Genentech Nonclinical Biostatistics
Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
More information about the R-help
mailing list