R: Easy Function Plot

ezplot {pracma} | R Documentation

## Easy Function Plot

### Description

Easy function plot w/o the need to define `x, y` coordinates.

### Usage

    fplot(f, interval, ...)

    ezplot( f, a, b, n = 101, col = "blue", add = FALSE,
            lty = 1, lwd = 1, marker = 0, pch = 1,
            grid = TRUE, gridcol = "gray",
            fill = FALSE, fillcol = "lightgray",
            xlab = "x", ylab = "f (x)", main = "Function Plot", ...)

### Arguments

`f` | Function to be plotted.
`interval` | interval [a, b] to plot the function in
`a, b` | Left and right endpoint for the plot.
`n` | Number of points to plot.
`col` | Color of the function graph.
`add` | logical; shall the polt be added to an existing plot.
`lty` | line type; default 1.
`lwd` | line width; default 1.
`marker` | no. of markers to be added to the curve; defailt: none.
`pch` | poimt character; default circle.
`grid` | Logical; shall a grid be plotted?; default `TRUE`.
`gridcol` | Color of grid points.
`fill` | Logical; shall the area between function and axis be filled?; default: `FALSE`.
`fillcol` | Color of fill area.
`xlab` | Label on the `x`-axis.
`ylab` | Label on the `y`-axis.
`main` | Title of the plot
`...` | More parameters to be passed to `plot`.

### Details

Calculates the `x, y` coordinates of points to be plotted and calls the `plot` function.

If `fill` is `TRUE`, also calls the `polygon` function with the `x, y` coordinates in appropriate order.

If the no. of `markers` is greater than 2, this number of markers will be added to the curve, with equal distances measured along the curve.

### Value

Plots the function graph and invisibly returns `NULL`.

### Note

`fplot` is almost an alias for `ezplot` as all `ez...` will be replaced by MATLAB with function names `f...` in 2017.

`ezplot` should mimick the Matlab function of the same name, has more functionality, misses the possibility to plot several functions.

### See Also

`curve`

### Examples

    ## Not run:
    fun <- function(x) x * cos(0.1*exp(x)) * sin(0.1*pi*exp(x))
    ezplot(fun, 0, 5, n = 1001, fill = TRUE)

    ## End(Not run)

[Package pracma version 2.0.4 Index]