slice_plot {mosaicCalc}R Documentation

Plot a function of a single variable

Description

In a slice plot, there is one independent variable. The graph shows the output of the function versus the independent variable. It's called a slice plot to distinguish it from a contour plot, in which the graph has one axis for each independent variable and the output of the function is shown by color and labels.

Usage

slice_plot(
  ...,
  npts = 101,
  color = "black",
  alpha = 1,
  label_text = "",
  label_x = 1,
  label_vjust = "top",
  label_color = color,
  label_alpha = alpha,
  singularities = numeric(0)
)

Arguments

...

Canonical first three argument: ⁠[gg]⁠, tilde expression, ⁠[domain]⁠ as well as any parameters to be assigned or re-assigned.

npts

Integer, number of points at which to evaluate the function.

color

Color of curve

alpha

Alpha of curve

label_text

character string label to place near the graph curve. Default: none.

label_x

number between 0 and 1 indicating the horizontal placement of the label_text.

label_vjust

vertical justification of label. One of "left", "middle", "right", "bottom", "center", "top", "inward", or "outward"

label_color

color of label

label_alpha

alpha of label

singularities

numeric vector of x positions at which to break the graph.

Additional arguments will be passed to geom_line(). Use, e.g. color="red"

Value

ggplot2 layers

Examples

## Not run: 
slice_plot(sin(x) ~ x, domain(x = range(-5, 15)))
f <- makeFun(sin(2*pi*t/P) ~ t)
slice_plot(f(t, P=20) ~ t, domain(t = -5:10), label_text = "Period 20", label_x=0.9)
slice_plot(x^2 ~ x) # Error: no domain specified
slice_plot(cos(x) ~ x, domain(x[-10:10]) # domain will be -10 < x < 10
# see domain

## End(Not run)


[Package mosaicCalc version 0.6.4 Index]