vc_plot_tangent: Plot an approximate tangent and its function

View source: R/plot_local_models.R

vc_plot_tangentR Documentation

Plot an approximate tangent and its function

Description

Display the approximation and its sensitivity status. A plotted line does not certify that the mathematical tangent exists.

Usage

vc_plot_tangent(
  result,
  f,
  xlim = NULL,
  n = 401L,
  colors = c(curve = "#24476b", line = "#c44736", point = "#222222", differential =
    "#188367", change = "#8250a3"),
  title = NULL,
  xlab = "x",
  ylab = "y"
)

Arguments

result

Plain result list from the corresponding calculation function.

f

The same deterministic scalar function used for the calculation. Function values at the stored anchor points must match the result.

xlim

Optional increasing pair of finite real plot limits, containing the anchor points. NULL derives limits around the anchors.

n

Integer number of curve samples, at least 2. The curve is a sampled visualization, not an exact representation or a continuity test.

colors

Named character vector with entries curve, line, point, differential, and change; values are Plotly/CSS colors.

title

Optional scalar plot title. NULL uses a descriptive default.

xlab, ylab

Scalar axis labels.

Details

All sampling limitations of vc_plot_secant() apply. The legend identifies an approximate tangent and the subtitle reports numerical sensitivity status. One-sided methods are identified explicitly.

Value

An interactive plotly htmlwidget with function, line and anchor.

Examples

if (requireNamespace("plotly", quietly = TRUE)) {
  vc_tangent(sin, 0) |> vc_plot_tangent(f = sin)
}

vectorialcalculus documentation built on Nov. 17, 2026, 1:09 a.m.