dplot3_varimp: Interactive Variable Importance Plot

View source: R/dplot3_varimp.R

dplot3_varimpR Documentation

Interactive Variable Importance Plot

Description

Plot variable importance using plotly

Usage

dplot3_varimp(
  x,
  names = NULL,
  main = NULL,
  xlab = "Variable Importance",
  ylab = "",
  plot.top = 1,
  labelify = TRUE,
  col = NULL,
  alpha = 1,
  palette = NULL,
  mar = NULL,
  font.size = 16,
  axis.font.size = 14,
  theme = rtTheme,
  showlegend = TRUE,
  ...
)

Arguments

x

Vector, numeric: Input

names

Vector, string: Names of features

main

Character: main title

xlab

Character: x-axis label

ylab

Character: y-axis label

plot.top

Float or Integer: If <= 1, plot this percent highest absolute values, otherwise plot this many top values. i.e.: plot.top = .2 will print the top 20% highest values, and plot.top = 20 will plot the top 20 highest values

labelify

Logical: If TRUE convert names(x) using labelify. Default = TRUE

col

Vector, colors: Single value, or multiple values to define bar (feature) color(s)

alpha

Numeric: Transparency

palette

Character: Name of rtemis palette to use.

mar

Vector, numeric, length 4: Plot margins in pixels (NOT inches). Default = c(50, 110, 50, 50)

font.size

Integer: Overall font size to use (essentially for the title at this point). Default = 14

axis.font.size

Integer: Font size to use for axis labels and tick labels (Seems not to be in same scale as font.size for some reason. Experiment!)

theme

Output of an rtemis theme function (list of parameters) or theme name. Use themes() to print available themes.

showlegend

Logical: If TRUE, show legend

...

Additional arguments passed to theme

Details

A simple plotly wrapper to plot horizontal barplots, sorted by value, which can be used to visualize variable importance, model coefficients, etc.

Author(s)

E.D. Gennatas

Examples

# made-up data
x <- rnorm(10)
names(x) <- paste0("Feature_", seq(x))
dplot3_varimp(x)

egenn/rtemis documentation built on Dec. 17, 2024, 6:16 p.m.