Unverified Commit 6d4d1abc authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[R-package] improve safety of index selection in plotting (#5485)

parent a65ba42c
...@@ -79,7 +79,7 @@ lgb.plot.importance <- function(tree_imp, ...@@ -79,7 +79,7 @@ lgb.plot.importance <- function(tree_imp,
) )
) )
tree_imp[.N:1L, tree_imp[rev(seq_len(.N)),
graphics::barplot( graphics::barplot(
height = get(measure) height = get(measure)
, names.arg = Feature , names.arg = Feature
......
...@@ -146,7 +146,7 @@ multiple.tree.plot.interpretation <- function(tree_interpretation, ...@@ -146,7 +146,7 @@ multiple.tree.plot.interpretation <- function(tree_interpretation,
# create plot # create plot
tree_interpretation[abs(Contribution) > 0.0, bar_color := "firebrick"] tree_interpretation[abs(Contribution) > 0.0, bar_color := "firebrick"]
tree_interpretation[Contribution == 0.0, bar_color := "steelblue"] tree_interpretation[Contribution == 0.0, bar_color := "steelblue"]
tree_interpretation[.N:1L, tree_interpretation[rev(seq_len(.N)),
graphics::barplot( graphics::barplot(
height = Contribution height = Contribution
, names.arg = Feature , names.arg = Feature
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment