plot_g_persp: Plot g-function as a static 3D perspective (for reports)

View source: R/plot_results.R

plot_g_perspR Documentation

Plot g-function as a static 3D perspective (for reports)

Description

Creates a base R persp() 3D surface plot for g-function groups with d >= 2. For d <= 1, produces a 2D scatter plot (same as plot_g_function()). The surface is colored by contribution value using a blue-white-red scale. Suitable for PDF and Word output where interactive plotly is not available.

Usage

plot_g_persp(
  earth_result,
  group_index,
  theta = 30,
  phi = 25,
  response_idx = NULL
)

Arguments

earth_result

An object of class "earthUI_result" as returned by fit_earth().

group_index

Integer. Index of the g-function group (1-based, from list_g_functions()).

theta

Numeric. Azimuthal rotation angle in degrees. Default 30.

phi

Numeric. Elevation angle in degrees. Default 25.

response_idx

Integer or NULL. For multivariate models, which response column to plot (1-based). Default NULL uses the first response.

Value

Invisible NULL (base graphics). For d <= 1, returns a ggplot object.

Examples


result <- fit_earth(mtcars, "mpg", c("cyl", "disp", "hp", "wt"), degree = 2L)
plot_g_persp(result, 1)


earthUI documentation built on March 26, 2026, 1:07 a.m.