vc_plot_riemann: Draw signed Riemann rectangles with optional refinement...

View source: R/plot_riemann.R

vc_plot_riemannR Documentation

Draw signed Riemann rectangles with optional refinement animation

Description

Draw signed Riemann rectangles with optional refinement animation

Usage

vc_plot_riemann(
  result,
  f,
  n = 401L,
  colors = c(curve = "#24476b", positive = "#188367", negative = "#c44736", edge =
    "#333333"),
  alpha = 0.45,
  line_width = 1,
  animate = TRUE,
  frame_ms = 700,
  title = NULL,
  xlab = "x",
  ylab = "f(x)"
)

Arguments

result

Result from vc_riemann() or vc_riemann_convergence().

f

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

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 curve, positive, negative and edge Plotly/CSS colors.

alpha

Finite fill opacity between zero and one.

line_width

Nonnegative finite rectangle edge width.

animate

Logical; animate multiple stored refinements. A single stored sum is static. No new sums are computed by this function.

frame_ms

Positive finite animation frame duration in milliseconds.

title

Optional scalar plot title. NULL uses a descriptive default.

xlab, ylab

Scalar axis labels.

Details

Rectangles extend from zero to f(sample), including below zero. This baseline is deliberately fixed to preserve the integral interpretation. Invalid curve samples are gaps. The curve is sampled, not an integrability proof. Hover shows n, rule, signed sum and rectangle contribution.

Value

Plotly widget with sampled curve and zero-based signed rectangles.

Examples

if(requireNamespace("plotly",quietly=TRUE)) {
  f <- function(x)x^2
  f |> vc_riemann_convergence(c(0,2),reference=8/3) |> vc_plot_riemann(f=f)
}

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