Hello,
I''m plotting two y axes and have had good success using plot
(specifying
axes=F and ann=F) then adding the y axis to the right with axis(4...) and
overlaying another plot (this time leaving the axis and labels in place.
My difficulty lies in getting a label for the right-side y-axis.
Here''s the code I''m using:
plot(spectrum[, 1], spectrum[, 2], xlim = xlim, ylim = ylim,
type = "l", axes=F, ann=F)
par(new = TRUE)
plot(spectrum[, 1], preemp[, 2], xlim = xlim, ylim = ylim,
type = "l", col = "red", ann = FALSE, axes=F)
axis(4, labels=T, tick=T, ylim=ylim, ylab="Amplitude (dB)")
abline(v = f1, lty = 3)
par(new = TRUE)
ylim2 <- c(min(centroids[, 2]), max(centroids[, 2]))
plot(centroids[, 1], centroids[, 2],
xlim = xlim, ylim = ylim2, type="b", xlab="Freqeuncy
(Hz)",
ylab="Percent total amplitude (%)")
Thanks in advance.
D
S. David White
sdavidwhite at bigfoot.com
Columbus, Ohio
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
David White <dwhite at ling.ohio-state.edu> writes:> Hello, > > I''m plotting two y axes and have had good success using plot (specifying > axes=F and ann=F) then adding the y axis to the right with axis(4...) and > overlaying another plot (this time leaving the axis and labels in place. > My difficulty lies in getting a label for the right-side y-axis.By default there is only room for 2.1 lines of text on the right hand side of a plot. The tick marks take one and the labels another and there needs to be a blank line between labels and axis title.... I.e. you likely need to play with par(mar=) to get at least 4 lines on that side. Also, axis() doesn''t take a ylab argument so try mtext("Heyho",side=4,line=3) -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /''_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._