vc_plot_accumulation: Explore accumulation and signed regions interactively

View source: R/plot_accumulation.R

vc_plot_accumulationR Documentation

Explore accumulation and signed regions interactively

Description

Explore accumulation and signed regions interactively

Usage

vc_plot_accumulation(
  result,
  f,
  fundamental = NULL,
  n = 101L,
  colors = c(curve = "#24476b", positive = "#188367", negative = "#c44736", accumulation
    = "#8250a3", derivative = "#dd8800"),
  alpha = 0.35,
  line_width = 2,
  line_dash = c("solid", "dash", "dot", "dashdot"),
  animate = TRUE,
  frame_ms = 600,
  xlim = NULL,
  title = NULL,
  xlab = "x",
  ylab = "f(x)",
  alab = "A(x)"
)

Arguments

result

Result from vc_accumulation().

f

The same scalar function used for accumulation. The sampled function is drawn without recomputing any integrals.

fundamental

Optional vc_fundamental() result with exactly the same lower limit and x vector. Its derivative estimates are overlaid on f; hover and open markers retain inconclusive/mismatch diagnostics.

n

Integer number of curve/fill samples, at least two per frame.

colors

Named curve, positive, negative, accumulation and derivative Plotly/CSS colors. Positive/negative identify heights above/below zero, not the sign of a reversed integral.

alpha

Finite fill opacity from zero to one.

line_width

Positive finite curve width.

line_dash

One of solid, dash, dot or dashdot for sampled curves.

animate

Logical. Multiple stored upper limits get playback and a slider; FALSE draws the last stored limit. A single limit is static.

frame_ms

Positive finite animation duration in milliseconds.

xlim

Optional finite increasing display bounds covering lower and every stored x. NULL selects their range with padding for a single point.

title

Optional scalar title.

xlab, ylab, alab

Scalar labels for x, f(x) and A(x).

Details

Only stored integrals and comparisons are displayed. Function sampling and linear joins between accumulation nodes are illustrative, not new quadrature. Fill is not an unsigned-area computation; for x below lower the integral reverses sign even though heights remain unchanged. Invalid f samples are gaps. Theorems, continuity and integrability are not visually certified. Linear axes preserve signed-area interpretation.

Value

Two-panel Plotly widget: sampled f with zero-based positive/negative fills between lower and selected x, and sampled accumulation with a synchronized zero-to-A segment. Orientation, integral estimate, estimated error and status appear in hover. All stored accumulation nodes remain visible.

Examples

if(requireNamespace("plotly",quietly=TRUE)) {
  f <- function(x)x^2
  f |> vc_accumulation(seq(0,2,length.out=9)) |> vc_plot_accumulation(f=f)
}

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