[R] axis label using expression()

Henrique Dallazuanna wwwhsd at gmail.com
Mon Sep 28 17:13:03 CEST 2009


Try this:

 plot(x,y,xlab=expression(hat(P)*4[k]))

On Mon, Sep 28, 2009 at 11:59 AM,  <Tobias.Mathow at forst.bwl.de> wrote:
> Probably a very simple problem:
>
>
>
> I want to annotate a plot axis with a name of my data using
> expression().
>
> The name for the data is $\hat P4_k$ written in LaTex style -> hat
> symbol above P, followed by a 4 and a subscripted k index
>
>
>
> I tried to write this using
>
>
>
>
>
> x<-c(1,2,3,4)
>
> y<-c(3,5,7,9)
>
>
>
> plot(x,y,xlab=expression(hat(P4[k])) )
>
>
>
>
>
> but cant find a way to force the hat symbol to be located only above the
> P symbol and not above the 4 symbol.
>
>
>
> I have spent some time looking up ?expression, ?plotmath as well as some
> other R docu but cannot find a way.
>
> Any help is greatly appreciated.
>
> Regards, toby
>
>
>
>
>
>
>        [[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.
>



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




More information about the R-help mailing list