On 24/09/2015 6:26 PM, Hermann Norpois wrote: > Hello, > > I am looking for a possibility to define something like ylim for lines. I > thought, there might be a possibility to define the range of lines by means > of par ("usr") but I did not find the correct syntax. In my toy example I > would like to stop the red line at y=0.3. > Thanks Hermann > > toy example: > > x <- seq (-3,3, by=0.1) > y1 <- dnorm (x) > y2 <- pnorm (x) > plot (x,y1) > lines (x,y2, col="red") >
The clip() function does what you want. You could use clip(min(x), max(x), min(y2), 0.3) before the call to lines() to get what you want. See the example in the help page for how to restore the full region. Duncan Murdoch ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.