if I want to specify y-coordinates for the heights of horizontal lines to go across a plot. x <- c(1,2,3,6,4,8,4,7) y <- c(3,2,7,4,5,4,5,6) h <- c(3,5,7) plot(x,y) abline(y=h) However I got error message: Warning message: parameter "y" couldn't be set in high-level plot() function (I tried abline(h=y) , it;s not what I want also) Do u know why? --------------------------------- [[alternative HTML version deleted]]
?abline in R 1.8.1 includes the following: Usage: abline(a, b, untf = FALSE, ...) abline(h=, untf = FALSE, ...) abline(v=, untf = FALSE, ...) abline(coef=, untf = FALSE, ...) abline(reg=, untf = FALSE, ...) It looks to me like you want "abline(h=h)". hope this helps. spencer graves Grace Conlon wrote:>if I want to specify y-coordinates for the heights of horizontal lines to go across a plot. > >x <- c(1,2,3,6,4,8,4,7) >y <- c(3,2,7,4,5,4,5,6) >h <- c(3,5,7) >plot(x,y) >abline(y=h) > >However I got error message: >Warning message: >parameter "y" couldn't be set in high-level plot() function >(I tried abline(h=y) , it;s not what I want also) > >Do u know why? > > > >--------------------------------- > > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >stat.math.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! R-project.org/posting-guide.html > >
So exactly what do you want? h <- c(3,5,7) abline(h=h) draws three horizontal lines at y=3, 5, and 7, as the help page for abline says it should. [Note: that's abline(h=h), not abline(y=h).] Andy> From: Grace Conlon > > if I want to specify y-coordinates for the heights of > horizontal lines to go across a plot. > > x <- c(1,2,3,6,4,8,4,7) > y <- c(3,2,7,4,5,4,5,6) > h <- c(3,5,7) > plot(x,y) > abline(y=h) > > However I got error message: > Warning message: > parameter "y" couldn't be set in high-level plot() function > (I tried abline(h=y) , it;s not what I want also) > > Do u know why? > > > > --------------------------------- > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > R-project.org/posting-guide.html > >------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments,...{{dropped}}
> x <- c(1,2,3,6,4,8,4,7) > y <- c(3,2,7,4,5,4,5,6) > h <- c(3,5,7) > plot(x,y) > abline(y=h)abline(h=h) will work.
abline does not have a y parameter so it is letting you know that you have specified an invalid parameter. See ?abline Issuing the command args(abline) is another way to find out the arguments to a command. At any rate, based on your description I think you want segments. See ?segments --- Date: Mon, 8 Mar 2004 09:54:08 -0800 (PST) From: Grace Conlon <gracestat at yahoo.com> To: <R-help at stat.math.ethz.ch> Subject: [R] abline if I want to specify y-coordinates for the heights of horizontal lines to go across a plot. x <- c(1,2,3,6,4,8,4,7) y <- c(3,2,7,4,5,4,5,6) h <- c(3,5,7) plot(x,y) abline(y=h) However I got error message: Warning message: parameter "y" couldn't be set in high-level plot() function (I tried abline(h=y) , it;s not what I want also) Do u know why?
Hi On 8 Mar 2004 at 9:54, Grace Conlon wrote:> if I want to specify y-coordinates for the heights of horizontal lines > to go across a plot. > > x <- c(1,2,3,6,4,8,4,7) > y <- c(3,2,7,4,5,4,5,6) > h <- c(3,5,7) > plot(x,y) > abline(y=h)try abline(h=h) see ?abline Cheers> > However I got error message: > Warning message: > parameter "y" couldn't be set in high-level plot() function > (I tried abline(h=y) , it;s not what I want also) > > Do u know why? > > > > --------------------------------- > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > R-project.org/posting-guide.htmlPetr Pikal petr.pikal at precheza.cz