creates an interactive parallel categories diagram from an 'easyalluvial' plot using the 'plotly.js' library
parcats(
p,
marginal_histograms = TRUE,
data_input = NULL,
imp = TRUE,
width = NULL,
height = NULL,
elementId = NULL,
hoveron = "color",
hoverinfo = "count+probability",
arrangement = "perpendicular",
bundlecolors = TRUE,
sortpaths = "forward",
labelfont = list(size = 24, color = "black"),
tickfont = NULL,
offset_marginal_histograms = 0.7,
offset_imp = 0.9
)
alluvial plot
logical, add marginal histograms, Default: TRUE
dataframe, data used to create alluvial plot, Default: NULL
dataframe, with not more then two columns one of them numeric containing importance measures and one character or factor column containing corresponding variable names as found in training data.
integer, htmlwidget width in pixels, Default: NULL
integer, htmlwidget height in pixels, Default: NULL
, htmlwidget elementid, Default: NULL
character, one of c('category', 'color', 'dimension'), Sets the hover interaction mode for the parcats diagram.', 'If `category`, hover interaction take place per category.', 'If `color`, hover interactions take place per color per category.', 'If `dimension`, hover interactions take place across all categories per dimension., Default: 'color'
character, one of c('count', 'probability', 'count+probability') set info displayed on mouse hover Default: 'count+probability'
character, one of c('perpendicular', 'freeform', 'fixed') 'Sets the drag interaction mode for categories and dimensions.', 'If `perpendicular`, the categories can only move along a line perpendicular to the paths.', 'If `freeform`, the categories can freely move on the plane.', 'If `fixed`, the categories and dimensions are stationary.', Default: 'perpendicular'
logical, 'Sort paths so that like colors are bundled together within each category.', Default: TRUE
character, one of c('forward', 'backward'), 'Sets the path sorting algorithm.', 'If `forward`, sort paths based on dimension categories from left to right.', Default: 'forward' 'If `backward`, sort paths based on dimensions categories from right to left.'
list, 'Sets the font for the `dimension` labels.', Default: list(size = 24, color = 'black')
list, Sets the font for the `category` labels.', Default: NULL
double, height ratio reserved for parcats diagram, Default: 0.8
double, width ratio reserved for parcats diagram, Default: 0.9
htmlwidget
most parameters are best left at default values
# \donttest{
library(easyalluvial)
# alluvial wide ---------------------------------
p = alluvial_wide(mtcars2, max_variables = 5)
#> Warning: There was 1 warning in `mutate()`.
#> ℹ In argument: `mpg = (function (f, na_level = "(Missing)") ...`.
#> Caused by warning:
#> ! `fct_explicit_na()` was deprecated in forcats 1.0.0.
#> ℹ Please use `fct_na_value_to_level()` instead.
#> ℹ The deprecated feature was likely used in the easyalluvial package.
#> Please report the issue to the authors.
parcats(p, marginal_histograms = FALSE)
parcats(p, marginal_histograms = TRUE, data_input = mtcars2)
if(check_pkg_installed("randomForest", raise_error = FALSE)) {
# alluvial for model response --------------------
df = mtcars2[, ! names(mtcars2) %in% 'ids' ]
m = randomForest::randomForest( disp ~ ., df)
imp = m$importance
dspace = get_data_space(df, imp, degree = 3)
pred = predict(m, newdata = dspace)
p = alluvial_model_response(pred, dspace, imp, degree = 3)
parcats(p, marginal_histograms = TRUE, imp = TRUE, data_input = df)
}
# }