Learn R Programming

dtGAP (version 0.0.2)

draw_all: Draw Full Visualization: Decision Tree with Heatmap and Evaluation

Description

This function creates a full-page layout consisting of a decision tree plot, a heatmap, and optional evaluation results. It is designed for use in reporting classification or clustering trees with additional visual indicators.

Usage

draw_all(
  prepare_tree,
  heat,
  total_w = 297,
  total_h = 210,
  layout,
  x_eval_start = 15,
  y_eval_start = NULL,
  eval_text = 7,
  eval_res = NULL,
  print_eval = TRUE,
  show_col_prox = TRUE,
  show_row_prox = TRUE
)

Value

Draws the full visualization to the current graphics device. Called for its side effect; returns invisible(NULL).

Arguments

prepare_tree

A list returned from a tree preparation function, containing plot_data and branches for tree structure.

heat

A grob object representing the heatmap visualization. Usually generated with grid.grabExpr(draw(...))

total_w

Total width of the drawing in mm. Default is 297 (A4 landscape width).

total_h

Total height of the drawing in mm. Default is 210 (A4 landscape height).

layout

A list specifying layout parameters: tree_w, tree_h, margin, and offset_h.

x_eval_start

X-axis starting position (in mm) for evaluation text. Default is 15.

y_eval_start

Y-axis starting position (in mm) for evaluation text. If NULL, it will be computed automatically.

eval_text

Font size for the evaluation text. Default is 6.

eval_res

A list with evaluation result text from eval_tree() (including data_info, train_metrics, and test_metrics).

print_eval

Logical, whether to show evaluation results. Default is TRUE.

show_col_prox

Logical, whether to show column proximity.

show_row_prox

Logical, whether to show row proximity.

Examples

Run this code
# \donttest{
# See dtGAP() for a full end-to-end example
# that internally calls draw_all().
# }

Run the code above in your browser using DataLab