[R] Horizontal Y axis title above the y axis

Andres Christian christian.andres at fibl.org
Thu Nov 24 16:08:49 CET 2011


Dear Duncan

Thanks for your help.

However, your suggestion still does not solve my problem because mtext() only allows me to put the text at the beginning of the Y axis (adj=0), but not centered above it, because values below 0 are not permitted for the parameter adj.

Best regards
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


-----Ursprüngliche Nachricht-----
Von: Duncan Murdoch [mailto:murdoch.duncan at gmail.com] 
Gesendet: Donnerstag, 24. November 2011 16:02
An: Andres Christian
Cc: R-help at r-project.org
Betreff: Re: [R] Horizontal Y axis title above the y axis

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