[R] Horizontal labels on a plot

David Winsemius dwinsemius at comcast.net
Fri Jun 7 21:37:29 CEST 2013


On Jun 7, 2013, at 8:38 AM, Shane Carey wrote:

> Hi,
> 
> I have a plot with horizontal lables on the x-axis. For example:
> Devonian volcanic rocks
> n=2
> 
> with n=2 on a new line. How do I centre n=2 under the " Devonian volcanic
> rocks  "
> label?
> 
> This was my code: text(axis_text, par("usr")[three], labels = paste(LABELS,
> " \n ", " n =", t(t(name.count[,two]))), srt = txt_di,  adj = txtadj, xpd =
> TRUE, cex=txt_cex)
> 

Try: 

 …, labels=bquote( atop(.(LABELS) , n==.(name.count[,two]) ) ), …

(Unable to test with all those undefined parameters.)

?plotmath
# where one can read that "\n" is not honored by plotmath functions, including paste().
?bquote

-- 
David

> where LABELS=Devonian volcanic rocks
> and name.count[,two] =2
> 

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list