[R] using subscripts in a plot title with 2 lines

Paul Murrell p.murrell at auckland.ac.nz
Tue Apr 20 04:24:03 CEST 2004


Hi


Liaw, Andy wrote:
> If I understood your problem correctly, one ugly way of getting around this
> is to use call mtext() twice to put the two lines in the title area, using
> the line argument to mtext to control the location of the lines.  E.g.,
> something like:
> 
> plot(1, main="")
> mtext(expression(IC[50]), line=3, side=3, cex=1.2)
> mtext("of My Data", line=1.5, side=3, cex=1.2)


An alternative that keeps everything as one expression is to use atop() 
within the expression rather than the '\n'.  For example:

plot(1, main="")
mtext(expression(paste(atop(paste('Plot of Observed vs. Predicted 
-log(', IC[50], ') Values for the PDGFR'),'Dataset'))), side=3, line=1.5)

But this may still look too ugly :)

In general, '\n' will not be handled very well within mathematical 
expressions.

Paul


>>From: Rajarshi Guha
>>
>>Hi,
>>  I'm making a plot in which the title takes up two lines. The title
>>contains a subscript but when I look at the plot it does'nt 
>>seem tocome
>>out properly. The code I'm using is:
>>
>>   xtxt = expression(paste('Observed -log( ', IC[50], ' )'))
>>   ytxt = expression(paste('Predicted -log( ', IC[50], ' )'))
>>   mtxt = expression(paste('Plot of Observed vs. Predicted -log(',
>>IC[50], ') Values for the PDGFR\nDataset'))
>>
>>   plot(tset$V2, tset$V3, xlim = c(-2,2), ylim = c(-2,2),
>>    pch = 19, col = "blue", 
>>    main=mtxt,
>>    xlab = xtxt,
>>    ylab = ytxt)
>>
>>Removing the IC[50] term makes it come out OK. 
>>Is there any way to get around this?
>>
>>Thanks,
>>
>>-------------------------------------------------------------------
>>Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net>
>>GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
>>-------------------------------------------------------------------
>>Does Ramanujan know Polish?
>>-- E.B. Ross
>>
>>______________________________________________
>>R-help at stat.math.ethz.ch mailing list
>>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide! 
>>http://www.R-project.org/posting-guide.html
>>
>>
> 
> 
> 
> ------------------------------------------------------------------------------
> Notice:  This e-mail message, together with any attachments,...{{dropped}}
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/




More information about the R-help mailing list