Re: [R] linebreaks in mathplot

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Thu, 21 Feb 2008 11:42:15 -0300

Perhaps:

txt <- list(A=bquote(a == .(a)~'%'), B=bquote(b==.(b)~km^2)) plot(c(0,100), c(0,100), xaxs="i", yaxs="i", type="n") text(95-cumsum(strheight(txt)), 95-cumsum(strheight(txt)), parse(text=txt))

On 21/02/2008, Bálint Czúcz <czucz_at_botanika.hu> wrote:
> Dear HelpeRs,
>
> I would like to do sg similar to:
>
> plot(c(0,100), c(0,100), xaxs="i", yaxs="i", type="n")
> txt <- paste("a =", a, "%\n b =", b, " km2", sep="")
> text(95, 95, txt, adj=c(1,1))
>
> just with the "km2" formatted with 2 in a superscript.
> I thought
>
> txt <- substitute("a = "*a*" %\n b ="*b*" km"*phantom()^2, list(a=a,b=b))
>
> would do it. However it does not work.
> Is it possible to formulate "multi-line" expressions in plotmath? What
> is the trick?
>
> Or I should break txt into separate lines, and place the lines
> independently using text and strheight()?
>
> Thanks,
> Bálint
>
> --
> > sessionInfo()
> R version 2.6.1 (2007-11-26)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=Hungarian_Hungary.1250;LC_CTYPE=Hungarian_Hungary.1250;LC_MONETARY=Hungarian_Hungary.1250;LC_NUMERIC=C;LC_TIME=Hungarian_Hungary.1250
>
> attached base packages:
> [1] grDevices graphics stats datasets utils methods base
>
> other attached packages:
> [1] JGR_1.5-8 iplots_1.1-1 JavaGD_0.4-3 rJava_0.5-1
>
> --
> Bálint Czúcz
> Institute of Ecology and Botany of the Hungarian Academy of Sciences
> H-2163 Vácrátót, Alkotmány u. 2-4. HUNGARY
> Tel: +36 28 360122/157 +36 70 7034692
>
> ______________________________________________
> 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.
>

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

______________________________________________
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.
Received on Thu 21 Feb 2008 - 14:46:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 21 Feb 2008 - 15:30:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive