[R] Horizontal Y axis title above the y axis

Duncan Murdoch murdoch.duncan at gmail.com
Thu Nov 24 16:02:04 CET 2011


On 24/11/2011 9:25 AM, Andres Christian wrote:
> Dear R-help team
>
> I have tried hard to turn my Y axis 90 degrees, so that it is written horizontally, and placing it above the Y axis, but I did not succeed.
>
> I have tried to adapt the following functions:
>
>
> -          plot()
>
> -          title()
>
> -          mtext()
>
> And some more that did not prove to be useful (e.g. text() etc).
>
> The closest I got to my aim was with mtext():
>
> mtext("Yield [kg/ha]", side=3, adj=0). However, font.lab=2 does not seem to work in mtext, meaning I could not make the text bold.

The parameter to mtext is just called "font", not "font.lab".  It is 
called font.lab in other functions because the have multiple types of 
text, and that's the one that is used for labels.

So this works:

mtext("Yield [kg/ha]", side=3, adj=0, font=2)


Duncan Murdoch

> Some forums suggest that you can specify the rotation in title(), and I tried crt() and srt() but this did not work either...
>
> Can you help me?
>
> Thanks in advance
> Christian
>
> ___________________________________
> Mr Christian Andres
> MSc ETH Agr
>
> Research Institute of Organic Agriculture (FiBL)
> International Division
> CH-5070 Frick, Switzerland
> Phone: +41 (0)62 865 7216
> E-mail: christian.andres at fibl.org<mailto:christian.andres at fibl.org>
>
>
> 	[[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.
pl



More information about the R-help mailing list