[R] titles with superscript and variale value

Henrique Dallazuanna wwwhsd at gmail.com
Sun Jan 27 22:52:59 CET 2008


Try this

plot(rnorm(100), main=bquote(Family ~ Gaussian ~ ";" ~ D^2 == .(d2)))


On 27/01/2008, Monica Pisica <pisicandru at hotmail.com> wrote:
>
>
> Hi everyone,
>
>
> I am trying to write a title for a plot which has a superscript like D^2 and a value of a variable stored in that variable..... i am not sure if i am clear so i will try an example:
>
>
>  Suppose i want my title to be like: Family: Gaussian; D^2 = 0.45
>
>
>  where i have the value 0.45 stored in variable d2 (which comes from some previous calculations, and depending which actual variables i am plotting, this d2 can have different values), and i want D^2 to be D superscrip 2.
>
>
>  I've tried the following command lines:
>
>
> > title(main = expression(paste( "Family: Gaussian; ", D^2, " = ", d2)))
>
>
>  which gives me the right superscript but instead of the value stored in d2 i get actually "d2" .... or
>
>
> > title(main = paste("Family: Gaussian; ", expression(D^2), " = ",d2))
>
>
>  which gives me the real value stored in d2 but no superscript for D .... it comes like D^2 instead.
>
>
>  I've tried few other command lines  more foolish than the ones above .... with no result. I will really appreciate if you have any suggestions to get this title right.
>
>
>  Thanks,
>
>
>  Monica
>
> _________________________________________________________________
> Climb to the top of the charts! Play the word scramble challenge with star power.
>
> n
> ______________________________________________
> 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



More information about the R-help mailing list