Learn R Programming

mosaic (version 0.2-3)

fplot: Plot a mathematical function

Description

Plot a mathematical function

Usage

fplot(x, ...)

## S3 method for class 'default': fplot(x, xlim, ylim, n = 200, args = list(), type = "l", xlab, ylab, ...)

Arguments

x
function-like object to be plotted. For functions, first argument must be numeric and output must be a numeric vector of the same length.
xlim
Limits on plotting window
ylim
Limits on plotting window
n
approximate number of points to use when generating plot
args
additional arguments to f
type
type of plot (see link{xyplot}).
xlab
x-axis label
ylab
y-axis label
...
additional arguments passed to xyplot

Value

  • a trellis plot produced by xyplot

Details

fplot uses a simple adaptive algorithm to sample more points in regions where the function is changing rapidly.

See Also

curve, xyplot

Examples

Run this code
fplot(sin)
fplot(sin,xlim=c(0,4*pi))
f <- function(t) { sin(1/t)  }
fplot(f)
fplot(f,n=500)

Run the code above in your browser using DataLab