Skip to content

Commit

Permalink
mshapviz importance plot color bar
Browse files Browse the repository at this point in the history
  • Loading branch information
mayer79 committed Sep 10, 2024
1 parent bc61993 commit 39fb917
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/plot_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
}

# Slimmer colorbars with less space
.slim_colorbar <- function(height = 1.2) {
.slim_colorbar <- function(height = 1.2, width = 0.5) {
ggplot2::theme(
legend.box.spacing = grid::unit(0, "lines"),
legend.key.spacing = grid::unit(0.3, "lines"),
legend.key.width = grid::unit(0.5, "lines"),
legend.key.width = grid::unit(width, "lines"),
legend.key.height = grid::unit(height, "lines"),
legend.ticks.length = ggplot2::rel(0.3)
)
Expand Down
3 changes: 2 additions & 1 deletion R/sv_importance.R
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ sv_importance.mshapviz <- function(object, kind = c("bar", "beeswarm", "both", "
) +
ggplot2::labs(fill = ggplot2::element_blank()) +
do.call(ggplot2::scale_fill_viridis_d, viridis_args) +
ggplot2::guides(fill = ggplot2::guide_legend(reverse = TRUE))
ggplot2::guides(fill = ggplot2::guide_legend(reverse = TRUE)) +
.slim_colorbar(width = 1)
} else { # facets
p <- ggplot2::ggplot(imp_df, ggplot2::aes(x = values, y = feature)) +
ggplot2::geom_bar(fill = fill, width = bar_width, stat = "identity", ...) +
Expand Down
Binary file modified man/figures/VIGNETTE-tidy-class-xgb-imp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 39fb917

Please sign in to comment.