Skip to contents

Accepts predictions from any model without keeping a fitted R object in the chart. Existing axis limits are preserved, including explicitly requested limits. Annotate child drawings before composing panels. For built-in GLM or GAM estimation, use draw_scatter() or draw_fit().

Usage

draw_add_fit(
  plot,
  x = NULL,
  y = NULL,
  lower = NULL,
  upper = NULL,
  name = "Fit",
  color = "#6ca3a0",
  line_width = 2,
  opacity = 0.2,
  x_axis = 0L,
  y_axis = 0L,
  layer = NULL
)

Arguments

plot

htmlwidget: Existing Cartesian ECharts drawing.

x, y

Numeric: Finite curve coordinates with distinct x values.

lower, upper

Optional Numeric: Paired finite interval bounds at every x.

name

Character: Legend label; a matching observation label links selection.

color

Character: Curve and interval color.

line_width

Numeric (0, Inf): Curve width in pixels.

opacity

Numeric [0, 1]: Interval opacity.

x_axis, y_axis

Integer [0, Inf): Zero-based axis indices.

layer

Optional FitLayer: Complete geometry; do not combine with other settings.

Value

htmlwidget: Drawing with native vector curve and interval layers.

Examples

draw_add_fit(draw_scatter(1:3, c(2, 4, 5)), 1:3, c(2.1, 3.8, 5.1), name = "Predicted")