vc_plot_directional: Plot a directional line restriction on a sampled scalar...

View source: R/plot_multivariable.R

vc_plot_directionalR Documentation

Plot a directional line restriction on a sampled scalar surface

Description

Plot a directional line restriction on a sampled scalar surface

Usage

vc_plot_directional(
  result,
  f,
  xlim = NULL,
  ylim = NULL,
  t_range = c(-1, 1),
  n = 61L,
  colors = c(surface = "#24476b", curve = "#188367", tangent = "#c44736", point =
    "#222222"),
  alpha = 0.45,
  line_width = 3,
  title = NULL,
  scene = list(aspectmode = "data")
)

Arguments

result

Two-dimensional vc_directional() result.

f

Deterministic scalar field accepting ONE numeric vector and returning one finite real scalar. For f(x,y), supply an explicit wrapper function(v)f(v[1],v[2]); no automatic signature guessing is performed.

xlim, ylim

Optional finite increasing surface bounds covering the point. NULL uses point plus/minus two; t_range controls the separate curve.

t_range

Finite increasing line-parameter bounds containing zero.

n

Integer number of contour samples per coordinate, at least two.

colors

Named surface, curve, tangent and point Plotly/CSS colors.

alpha

Finite contour opacity between zero and one.

line_width

Positive finite vector line width.

title

Optional scalar title; default reports numerical sensitivity.

scene

Plotly scene list for the three-dimensional vector view.

Details

Recovers the directional curve/surface idea of legacy directional_derivative3d. Curve height is sampled f(point+t*u), whereas the tangent height uses only the stored derivative estimate. The direction is a unit domain vector, so the parameter is domain distance. Failed diagnostics and one-sided methods are explicitly labeled. Missing samples are gaps, not proof that no intervening singularity exists.

Value

Plotly 3D surface with the actual line-restriction curve, numerical tangent through the stored point, and stored base point.

Examples

if(requireNamespace("plotly",quietly=TRUE)) {
  f <- function(v)v[1]^2+2*v[2]^2
  f |> vc_directional(c(1,1),c(1,1)) |> vc_plot_directional(f=f)
}

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