Jan Verbesselt
2004-Mar-20 14:35 UTC
[R] labels on axis(4) and adaptation of legend to size of the plot
Hi weekend R helpers, *Is it possible to get a ylabel on the right hand side axis ==> axis(4)? Thankx, Jan opar <- par(mfrow = c(2,1)) plot(ts.Origi[,1],ylab='NDII', main=name) # Add the legend text in the right order legend.txt <- c("NDII", "Inverse KBDI") legend(2001.8,0.29, legend.txt,col=c(1,2), lty=1) par(new=T) plot(ts.Origi[,2], yaxt="n", type="l", col=2, las=1, ylab="") axis(4) plot(ts.NDVIKB[,1],ylab='NDVI', main=name) # Add the legend text in the right order legend.txt <- c("NDVI", "Inverse KBDI") legend(2001.8,0.42, legend.txt,col=c(1,2), lty=1) par(new=T) plot(ts.NDVIKB[,2], yaxt="n", type="l", col=2, las=1, ylab="") axis(4)
Andrew Robinson
2004-Mar-20 14:45 UTC
[R] labels on axis(4) and adaptation of legend to size of the plot
Jan, try ?mtext Cheers Andrew On Saturday 20 March 2004 06:35, Jan Verbesselt wrote:> Hi weekend R helpers, > > *Is it possible to get a ylabel on the right hand side axis ==> axis(4)? > > Thankx, > Jan > > opar <- par(mfrow = c(2,1)) > plot(ts.Origi[,1],ylab='NDII', main=name) > # Add the legend text in the right order > legend.txt <- c("NDII", "Inverse KBDI") > legend(2001.8,0.29, legend.txt,col=c(1,2), lty=1) > par(new=T) > plot(ts.Origi[,2], yaxt="n", type="l", col=2, las=1, ylab="") > axis(4) > > plot(ts.NDVIKB[,1],ylab='NDVI', main=name) > # Add the legend text in the right order > legend.txt <- c("NDVI", "Inverse KBDI") > legend(2001.8,0.42, legend.txt,col=c(1,2), lty=1) > par(new=T) > plot(ts.NDVIKB[,2], yaxt="n", type="l", col=2, las=1, ylab="") > axis(4) > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html-- Andrew Robinson Ph: 208 885 7115 Department of Forest Resources Fa: 208 885 6226 University of Idaho E : andrewr at uidaho.edu PO Box 441133 W : http://www.uidaho.edu/~andrewr Moscow ID 83843 Or: http://www.biometrics.uidaho.edu No statement above necessarily represents my employer's opinion.
Patrick Burns
2004-Mar-20 14:55 UTC
[R] labels on axis(4) and adaptation of legend to size of the plot
Two tricks to know: You need to have enough room in that margin, so you probably need to set the "mar" graphics parameter. For example: par(mar=c(5,4,4,4) +.1) You then want to use "mtext", like: mtext(side=4, line=2, "the other ylab") Patrick Burns Burns Statistics patrick at burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and "A Guide for the Unwilling S User") Jan Verbesselt wrote:>Hi weekend R helpers, > >*Is it possible to get a ylabel on the right hand side axis ==> axis(4)? > >Thankx, >Jan > > opar <- par(mfrow = c(2,1)) > plot(ts.Origi[,1],ylab='NDII', main=name) > # Add the legend text in the right order > legend.txt <- c("NDII", "Inverse KBDI") > legend(2001.8,0.29, legend.txt,col=c(1,2), lty=1) > par(new=T) > plot(ts.Origi[,2], yaxt="n", type="l", col=2, las=1, ylab="") > axis(4) > > plot(ts.NDVIKB[,1],ylab='NDVI', main=name) > # Add the legend text in the right order > legend.txt <- c("NDVI", "Inverse KBDI") > legend(2001.8,0.42, legend.txt,col=c(1,2), lty=1) > par(new=T) > plot(ts.NDVIKB[,2], yaxt="n", type="l", col=2, las=1, ylab="") > axis(4) > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > > > >
Seemingly Similar Threads
- ERROR NaNs produced; when comparing two logistic regression models with the ANOVA CHI test
- cor.test() -> p-values may be incorrect due to tie
- Problem with legend
- Lineair regression modelling between time series //correlation analysis
- SEM standardized path coefficients