@@ -234,8 +234,10 @@ aspect_importance.default <- function(x, data,
234234# '
235235# ' @param x object of aspect_importance class
236236# ' @param bar_width bar width
237- # ' @param aspects_on_axis if TRUE, labels on axis Y show aspect names, otherwise
237+ # ' @param show_features if TRUE, labels on axis Y show aspect names, otherwise
238238# ' they show features names
239+ # ' @param aspects_on_axis alias for \code{show_features} held for backwards
240+ # ' compatibility
239241# ' @param add_importance if TRUE, plot is annotated with values of aspects
240242# ' importance
241243# ' @param digits_to_round integer indicating the number of decimal places used
@@ -278,6 +280,7 @@ aspect_importance.default <- function(x, data,
278280
279281
280282plot.aspect_importance <- function (x , ... , bar_width = 10 ,
283+ show_features = aspects_on_axis ,
281284 aspects_on_axis = TRUE ,
282285 add_importance = FALSE ,
283286 digits_to_round = 2 ,
@@ -300,7 +303,7 @@ plot.aspect_importance <- function(x, ..., bar_width = 10,
300303
301304# reformat features list --------------------------------------------------
302305
303- if (! aspects_on_axis ) {
306+ if (! show_features ) {
304307 x $ features <- sapply(x $ features , paste0 , collapse = " , " )
305308 }
306309
@@ -318,7 +321,7 @@ plot.aspect_importance <- function(x, ..., bar_width = 10,
318321
319322# prep plot ---------------------------------------------------------------
320323
321- if (aspects_on_axis ) {
324+ if (show_features ) {
322325 p <- ggplot(x , aes(variable_groups , ymin = 0 , ymax = importance ,
323326 color = a_sign )) +
324327 geom_linerange(size = bar_width ) +
@@ -330,12 +333,12 @@ plot.aspect_importance <- function(x, ..., bar_width = 10,
330333 facet_wrap(~ label , scales = " free_y" , nrow = 1 )
331334 }
332335
333- if (add_importance & aspects_on_axis ) {
336+ if (add_importance & show_features ) {
334337 p <- p + geom_text(aes(x = variable_groups , y = importance ,
335338 label = round(importance , digits_to_round ),
336339 hjust = hjust ), vjust = 0.5 , color = " #371ea3" ,
337340 size = text_size )
338- } else if (add_importance & ! aspects_on_axis ) {
341+ } else if (add_importance & ! show_features ) {
339342 p <- p + geom_text(aes(x = features , y = importance ,
340343 label = round(importance , digits_to_round ),
341344 hjust = hjust ),
0 commit comments