Thin S3 wrapper that dispatches to plot_boundary or plot_surface depending on plot.type.

# S3 method for class 'svmodt_node'
plot(
  x,
  y = NULL,
  ...,
  data = NULL,
  response = NULL,
  plot.type = c("surface", "boundary"),
  features = NULL,
  max_depth = NULL,
  check_accuracy = TRUE,
  resolution = NULL
)

Arguments

x

An svmodt_node returned by svm_split.

y

Ignored; present only to satisfy the graphics::plot generic signature.

...

Currently unused.

data

The original training data frame (required).

response

Character string naming the response column (required).

plot.type

One of "surface" (default) or "boundary".

features

Length-2 character vector of axis features ("surface" only; default uses root node features).

max_depth

Maximum depth to visualize ("boundary" only; default NULL = full tree).

check_accuracy

Logical; show per-node accuracy ("boundary" only; default TRUE).

resolution

Grid resolution per axis. Default 100 for "boundary", 200 for "surface".

Value

  • "boundary": invisibly returns the list from plot_boundary.

  • "surface": invisibly returns the ggplot2 object from plot_surface.

Examples

# \donttest{
tree <- svm_split(wdbc, response = "diagnosis", max_depth = 3)

# All-node boundary panels - prints first, returns list
viz <- plot(tree,
  data = wdbc, response = "diagnosis",
  plot.type = "boundary"
)
#> $depth_1_Root

#> 
#> $depth_2_Root_L

#> 
viz$plots[[2]] # second node


# Global decision surface
plot(tree,
  data = wdbc, response = "diagnosis",
  plot.type = "surface"
)


# Surface with explicit feature axes
plot(tree,
  data = wdbc, response = "diagnosis",
  plot.type = "surface",
  features = c("radius_mean", "concavity_mean")
)

# }