curve | R Documentation |
Plot a mathematical function of x on a new or existing plotting region.
curve(object, ...)
object |
gsplot object |
... |
Further graphical parameters may also be supplied as arguments. See 'Details'. |
Additional graphical parameter inputs:
expr
mathematic function in terms of x
from
x value indicating the beginning of the plotted function
to
x value indicating the end of the plotted function
n
integer, number of x values at which to evaluate expr
add
logical, TRUE=add to existing plot, FALSE=create new plot (default)
xlim
vector indicating the lower and upper x values of the plotting window
ylim
vector indicating the lower and upper y values of the plotting window
type
plot type, where 'l'=line, 'p'=point, etc
log
string indicating axes to have a log scale, where ""=none, "x"=x-axis, "y"=y-axis, and "xy"=both axes
col
line color
lty
line type
lwd
line width
legend.name
name that appears in the legend, see legend
for more legend parameters
curve
gs <- gsplot() %>%
points(x=c(1:5, 3.5), y=c(1:5, 6), legend.name="Stuff") %>%
lines(x=2:6, y=2:6, ylim=c(0,10)) %>%
axis(side=c(1,2),labels=TRUE) %>%
curve(x^3, from=0, to=10, col="blue", legend.name="x^3") %>%
legend("topright")
gs
gs <- gsplot() %>%
curve(sin(x), from=-2*pi, to=2*pi, legend.name="sin(x)") %>%
legend()
gs
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.