Examples for 'graphics::curve'


Draw Function Plots

Aliases: curve plot.function

Keywords: hplot

### ** Examples

plot(qnorm) # default range c(0, 1) is appropriate here,
plot of chunk example-graphics-curve-1
            # but end values are -/+Inf and so are omitted.
plot(qlogis, main = "The Inverse Logit : qlogis()")
abline(h = 0, v = 0:2/2, lty = 3, col = "gray")
plot of chunk example-graphics-curve-1
curve(sin, -2*pi, 2*pi, xname = "t")
plot of chunk example-graphics-curve-1
curve(tan, xname = "t", add = NA,
      main = "curve(tan)  --> same x-scale as previous plot")
plot of chunk example-graphics-curve-1
op <- par(mfrow = c(2, 2))
curve(x^3 - 3*x, -2, 2)
curve(x^2 - 2, add = TRUE, col = "violet")

## simple and advanced versions, quite similar:
plot(cos, -pi,  3*pi)
curve(cos, xlim = c(-pi, 3*pi), n = 1001, col = "blue", add = TRUE)

chippy <- function(x) sin(cos(x)*exp(-x/2))
curve(chippy, -8, 7, n = 2001)
plot (chippy, -8, -5)
plot of chunk example-graphics-curve-1
for(ll in c("", "x", "y", "xy"))
   curve(log(1+x), 1, 100, log = ll, sub = paste0("log = '", ll, "'"))
plot of chunk example-graphics-curve-1
par(op)

[Package graphics version 4.2.3 Index]