Learn R Programming

mosaic (version 0.2-3)

plotFun: Plotting mathematical expressions (EXPERIMENTAL)

Description

Plots out mathematical functions of one or two variables.

Usage

plotFun(expr, ..., add=FALSE, xlim=NULL, ylim=NULL, npts=NULL, ylab=NULL, xlab=NULL, zlab=NULL, main=NULL, lwd=1, col="black",filled=TRUE, nlevels=10, surface=FALSE, colorscheme=topo.colors,type="l",transparency=NULL)

Arguments

expr
A formula of the same sort used in newD and newAntiD.
...
Values for the variables and parameters contained in the expression.
add
If add=TRUE, add the new plot over the existing plot.
xlim,ylim
Limits for the x- and y-axes (or set using the independent variables)
npts
Approximately granularity of the plot.
ylab,xlab,zlab,main
Labels for the axes and the plot itself.
lwd
Line width for line plots
col
Color for line plots
filled
If filled=TRUE, then shade contour plots.
nlevels
Number of contour levels for contour plots.
surface
For functions of two variables, do a surface rather than a contour plot.
colorscheme
How to shade surface plots
type
Plotting type, e.g. "l", "p", as in plot
transparency
When overlaying a contour plot, the transparency of the overfill

Value

  • A function that encapsulates the mathematical expression.

Details

plotFun provides a way to plot out mathematical expressions. All variables and parameters contained in the expression must be given specific numerical values. The variables being plotted can be given a range of values.

Examples

Run this code
plotFun(A*sin(2*pi*t/P) ~ t, t=range(0,50), P=20, A=5)
f = plotFun(A*exp(-k*t)*sin(2*pi*t/P) ~ t & k, t=range(0,50), k=range(.01,.1), P=20, A=5)plotFun(f(t=7,A=3,P=5,k=k) ~ k, k=range(0.01,0.2))

Run the code above in your browser using DataLab