rgp (version 0.4-1)

plotFunctions: Show an overlayed plot of multiple functions

Description

Creates and shows and overlayed plot of one or more functions of one variable $y = f(x)$.

Usage

plotFunctions(funcs, from = 0, to = 1, steps = 1024, type = "l", lty = 1:5, lwd = 1, lend = par("lend"), pch = NULL, col = 1:6, cex = NULL, bg = NA, xlab = "x", ylab = "y", legendpos = "bottomright", bty = "n", ...)

Arguments

funcs
A list of functions of one variable to plot.
from
The left bound of the plot, i.e. the minimum $x$ value to plot.
to
The right bound of the plot, i.e. the maximum $x$ value to plot.
steps
The number of steps, or samples, to plot.
type
The plot type (e.g. l = line) as passed on to matplot.
lty
The line types as passed on to matplot.
lwd
The line widths as passed on to matplot.
lend
The line end cap types as passed on to matplot.
pch
The plot chars as passed on to matplot.
col
The plot colors as passed on to matplot.
cex
The character expansion sizes as passed on to matplot.
bg
The background (fill) colors as passed on to matplot.
xlab
The x axis label as passed on to matplot.
ylab
The y axis label as passed on to matplot.
legendpos
The position of the legend, passed as the x parameter to legend.
bty
The box type parameter of the legend, passed as the bty parameter to legend.
...
Graphic parameters for par and further arguments to plot. For example, use the main parameter to set a title.

Examples

Run this code
plotFunctions(list(function(x) sin(x),
                   function(x) cos(x),
                   function(x) 0.5*sin(2*x)+1),
              -pi, pi, 256)

Run the code above in your browser using DataCamp Workspace