Skip to content

Commit ef22102

Browse files
Copilotthorek1
andcommitted
Address code review feedback - extract repeated expression
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
1 parent 9deef81 commit ef22102

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ext/StatsPlotsExt.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,10 +622,11 @@ function _create_single_estimates_page(pp, container, non_zero_shock_idx, shock_
622622
if shock_decomposition
623623
additional_labels = pruning ? ["Initial value", "Nonlinearities"] : ["Initial value"]
624624
shock_names = [container[:shock_names][i] for i in non_zero_shock_idx]
625-
lbls = reshape(vcat(additional_labels, string.(shock_names)), 1, length(non_zero_shock_idx) + 1 + (pruning ? 1 : 0))
625+
legend_bar_count = length(non_zero_shock_idx) + 1 + (pruning ? 1 : 0)
626+
lbls = reshape(vcat(additional_labels, string.(shock_names)), 1, legend_bar_count)
626627

627628
StatsPlots.bar!(pl,
628-
fill(NaN, 1, length(non_zero_shock_idx) + 1 + (pruning ? 1 : 0)),
629+
fill(NaN, 1, legend_bar_count),
629630
label = lbls,
630631
linewidth = 0,
631632
alpha = transparency,

0 commit comments

Comments
 (0)