@@ -26,6 +26,18 @@ const default_plot_attributes = Dict(:size=>(700,500),
2626 :framestyle => :semi )
2727
2828
29+ const args_and_kwargs_names = Dict (:model_name => " Model" ,
30+ :algorithm => " Algorithm" ,
31+ :shock_size => " Shock size" ,
32+ :negative_shock => " Negative shock" ,
33+ :generalised_irf => " Generalised IRF" ,
34+ :ignore_obc => " Ignore OBC" ,
35+ # :tol => "Tolerance",
36+ # :quadratic_matrix_equation_algorithm => "Quadratic Matrix Equation Algorithm",
37+ # :sylvester_algorithm => "Sylvester Algorithm",
38+ # :lyapunov_algorithm => "Lyapunov Algorithm"
39+ )
40+
2941@stable default_mode = " disable" begin
3042"""
3143 gr_backend()
@@ -1317,7 +1329,7 @@ function plot_irf!(𝓂::ℳ;
13171329
13181330 diffdict = compare_args_and_kwargs (irf_active_plot_container)
13191331
1320- @assert haskey (diffdict, :parameters ) || haskey (diffdict, :shock_names ) || haskey (diffdict, :algorithm ) || haskey ( diffdict, :generalised_irf ) " New plot must be different from previous plot. Use the version without ! to plot."
1332+ @assert haskey (diffdict, :parameters ) || haskey (diffdict, :shock_names ) || any ( haskey .( Ref ( diffdict), keys (args_and_kwargs_names)) ) " New plot must be different from previous plot. Use the version without ! to plot."
13211333
13221334 annotate_ss = Vector{Pair{String, Any}}[]
13231335
@@ -1339,20 +1351,19 @@ function plot_irf!(𝓂::ℳ;
13391351 push! (annotate_diff_input, " Shock" => reduce (vcat,diffdict[:shock_names ]))
13401352 end
13411353 end
1342-
1343- if haskey (diffdict, :negative_shock )
1344- push! (annotate_diff_input, " Negative shock" => reduce (vcat,diffdict[:negative_shock ]))
1345- same_shock_direction = false
1346- else
1347- same_shock_direction = true
1348- end
13491354
1350- if haskey (diffdict, :algorithm )
1351- push! (annotate_diff_input, " Algorithm" => reduce (vcat,diffdict[:algorithm ]))
1352- end
1355+ same_shock_direction = true
13531356
1354- if haskey (diffdict, :generalised_irf )
1355- push! (annotate_diff_input, " Generalised IRF" => reduce (vcat,diffdict[:generalised_irf ]))
1357+ for k in setdiff (keys (args_and_kwargs), [:periods , :shocks , :variables , :parameters , :initial_state , :plot_data , :tol , :reference_steady_state , :quadratic_matrix_equation_algorithm , :sylvester_algorithm , :lyapunov_algorithm , :variable_names , :shock_names , :shock_idx , :var_idx ])
1358+ if haskey (diffdict, k)
1359+ push! (annotate_diff_input, args_and_kwargs_names[k] => reduce (vcat,diffdict[k]))
1360+
1361+ if k == :negative_shock
1362+ same_shock_direction = false
1363+ else
1364+ same_shock_direction = true
1365+ end
1366+ end
13561367 end
13571368
13581369 pushfirst! (annotate_diff_input, " Plot index" => 1 : len_diff)
@@ -1382,7 +1393,7 @@ function plot_irf!(𝓂::ℳ;
13821393 legend_title = length (annotate_diff_input) > 2 ? nothing : annotate_diff_input[2 ][1 ],
13831394 framestyle = :none ,
13841395 legend = :inside ,
1385- label = length (annotate_diff_input) > 2 ? i : annotate_diff_input[2 ][2 ][i] isa Bool ? String ( Symbol ( annotate_diff_input[2 ][2 ][i])) : annotate_diff_input[2 ][2 ][i])
1396+ label = length (annotate_diff_input) > 2 ? i : annotate_diff_input[2 ][2 ][i] isa String ? annotate_diff_input[2 ][2 ][i] : String ( Symbol ( annotate_diff_input[2 ][2 ][i])) )
13861397
13871398 push! (joint_shocks, k[:shock_names ]. .. )
13881399 push! (joint_variables, k[:variable_names ]. .. )
0 commit comments