Dear Duncan, Thank you very much for the response. I suspected that such an option has not been implemented yet.
The plot was very cluttered due to those vertical lines. Fortunately, the gamma function is easy to handle. But the feature remains on my wishlist as useful more in general. Sincerely, Leonard ________________________________ From: Duncan Murdoch <murdoch.dun...@gmail.com> Sent: Tuesday, February 13, 2024 6:05 PM To: Leo Mada <leo.m...@syonic.eu>; r-help@r-project.org <r-help@r-project.org> Subject: Re: [R] Skip jumps in curve On 13/02/2024 10:29 a.m., Leo Mada via R-help wrote: > Dear R-Users, > > Is there a way to skip over without plotting the jumps/discontinuities in > curve()? > > I have not seen such an option, but maybe I am missing something. > > plot.gamma = function(xlim = c(-6, -1), ylim = c(-1,3), hline = NULL, n = > 1000) { > curve(gamma(x), from = xlim[1], to = xlim[2], ylim=ylim, n=n); > if( ! is.null(hline)) abline(h = hline, col = "green"); > } > > Euler = 0.57721566490153286060651209008240243079; > plot.gamma(hline = Euler) > > Adding an option to the function curve may be useful: > options = c("warn", "silent", "unconnected") > > This is part of some experiments in math; but that's another topic. For > latest version: > https://github.com/discoleo/R/blob/master/Math/Integrals.Gamma.Inv.R If you know where the discontinuities are, plot multiple times with the discontinuities as endpoints: plot.gamma = function(xlim = c(-6, -1), ylim = c(-1,3), hline = NULL, n = 1000) { start <- floor(xlim[1]):floor(xlim[2]) end <- start + 1 start[1] <- xlim[1] end[length(end)] <- xlim[2] n <- round(n/length(start)) curve(gamma(x), from = start[1], to = end[1], ylim=ylim, n=n, xlim = xlim) for (i in seq_along(start)[-1]) curve(gamma(x), from = start[i], to = end[i], add = TRUE, n) if( ! is.null(hline)) abline(h = hline, col = "green"); } Euler = 0.57721566490153286060651209008240243079; plot.gamma(hline = Euler) If you don't know where the discontinuities are, it would be much harder, because discontinuities can be hard to detect unless the jumps are really big. Duncan Murdoch [[alternative HTML version deleted]] ______________________________________________ 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.