% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot_e2tree_vis.R
\name{plot_e2tree_vis}
\alias{plot_e2tree_vis}
\title{Interactive E2Tree Plot with visNetwork}
\usage{
plot_e2tree_vis(
  fit,
  data,
  ensemble,
  width = "100\%",
  height = "100\%",
  direction = "UD",
  node_spacing = 200,
  level_separation = 200,
  colors = NULL,
  show_percent = TRUE,
  show_prob = TRUE,
  show_n = TRUE,
  font_size = 14,
  edge_font_size = 12,
  split_label_style = "rpart",
  max_label_length = 50,
  details_on = "hover",
  navigation_buttons = FALSE,
  free_drag = FALSE
)
}
\arguments{
\item{fit}{An e2tree object}

\item{data}{The training data used to build the tree}

\item{ensemble}{The ensemble model (randomForest or ranger)}

\item{width}{Width of the widget (default: "100\%")}

\item{height}{Height of the widget (default: "100\%")}

\item{direction}{Layout direction: "UD" (top-down), "DU" (bottom-up),
"LR" (left-right), "RL" (right-left)}

\item{node_spacing}{Spacing between nodes at same level (default: 200)}

\item{level_separation}{Spacing between levels (default: 200)}

\item{colors}{Named vector of colors for classes, or NULL for auto}

\item{show_percent}{Show percentage in nodes (default: TRUE)}

\item{show_prob}{Show class probabilities in nodes (default: TRUE)}

\item{show_n}{Show observation count in nodes (default: TRUE)}

\item{font_size}{Font size for node labels (default: 14)}

\item{edge_font_size}{Font size for edge labels (default: 12)}

\item{split_label_style}{How to display split information:
\itemize{
\item "rpart" - Variable name in node, threshold on edges (like rpart.plot)
\item "full" - Full split rule on edges (variable + condition)
\item "threshold" - Only threshold values on edges (< 47, >= 47)
\item "yesno" - Simple yes/no on edges
\item "none" - No labels on edges (hover for details)
\item "innode" - Full split rule displayed IN the node (above stats)
}}

\item{max_label_length}{Maximum characters for edge labels before truncating (default: 50)}

\item{details_on}{When to show node details:
\itemize{
\item "hover" - Show on mouse hover (default, but may cover other nodes)
\item "click" - Show only on click (avoids covering highlighted nodes)
\item "none" - No tooltips (use for cleaner visualization)
}}

\item{navigation_buttons}{Show navigation buttons (default: FALSE)}

\item{free_drag}{If TRUE, nodes can be dragged in ALL directions (horizontal,
vertical, diagonal). If FALSE (default), nodes can only be
moved horizontally within their level.}
}
\value{
A visNetwork htmlwidget object
}
\description{
Displays an E2Tree as an interactive network plot using visNetwork.
Features: drag nodes anywhere, zoom, pan, click for details.
Starts with hierarchical layout, then you can freely move nodes.
}
\examples{
\donttest{
data(iris)
set.seed(42)
smp_size <- floor(0.75 * nrow(iris))
train_ind <- sample(seq_len(nrow(iris)), size = smp_size)
training <- iris[train_ind, ]

ensemble <- randomForest::randomForest(Species ~ ., data = training,
  importance = TRUE, proximity = TRUE)
D <- createDisMatrix(ensemble, data = training, label = "Species",
  parallel = list(active = FALSE, no_cores = 1))
setting <- list(impTotal = 0.1, maxDec = 0.01, n = 2, level = 5)
tree <- e2tree(Species ~ ., training, D, ensemble, setting)

# Basic usage
plot_e2tree_vis(tree, training, ensemble)
}

}
