[R] Add y-title to a plot with two y axis

jim holtman jholtman at gmail.com
Mon Sep 6 02:04:48 CEST 2010


?mtext


mtext("secondary y-axis label", 4, line=-1)

you will have to adjust 'line" to get your spacing the way you want it.

On Sun, Sep 5, 2010 at 7:52 PM, Magali teurlai <teurlaimag.r at gmail.com> wrote:
> Hi all,
>
> We managed to plot two series on the same graph, with two y-axis,
> however, we haven't managed to add a title to the second y-axis
>
> x1=rnorm(25, mean=0, sd=1)
> y1=dnorm(x1, mean=0, sd=1)
> x2=rnorm(25, mean=0, sd=1)
> y2=dnorm(x2, mean=0, sd=1)
>
> plot(x1, y1, type='p', xlab='x', ylab='y')
> par(new=TRUE)
> plot(x1, y2, type='p', axes= FALSE, col="red",ylab="", xlab="")
> axis(side=4)
>
> There are no parameters to the "axis" function to add a title.
>
> Does anyone know how to do ?
>
> Many Thanks in advance
>
> Mag
>
> ______________________________________________
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



More information about the R-help mailing list