From 698932a721fad60ee4a8db0be997b0214efda1d7 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Sat, 14 Aug 2021 17:19:31 -0700 Subject: [PATCH] Add super title, increase fig size and dpi --- integration_tests/utils/compute_mse.jl | 52 ++++++++++++++++++++------ 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/integration_tests/utils/compute_mse.jl b/integration_tests/utils/compute_mse.jl index c75d34c4c9..4a6de2ec28 100644 --- a/integration_tests/utils/compute_mse.jl +++ b/integration_tests/utils/compute_mse.jl @@ -131,7 +131,7 @@ end function compute_mse( - experiment, + case_name, best_mse, plot_dir; ds_dict, @@ -302,11 +302,11 @@ function compute_mse( end width_to_height_ratio = have_tc_main ? 15 / 10 : 15 / 10 - fig_height = 900 + fig_height = 1500 plot_attr[true]["contour_1_kwargs"] = ( bottom_margin = 0 * Plots.PlotMeasures.px, - left_margin = 30 * Plots.PlotMeasures.px, + left_margin = 40 * Plots.PlotMeasures.px, right_margin = 0 * Plots.PlotMeasures.px, top_margin = 0 * Plots.PlotMeasures.px, xticks = false, @@ -327,6 +327,7 @@ function compute_mse( plot_attr[true]["contour_3_kwargs"] = ( bottom_margin = 0 * Plots.PlotMeasures.px, left_margin = 0 * Plots.PlotMeasures.px, + right_margin = -20 * Plots.PlotMeasures.px, top_margin = 0 * Plots.PlotMeasures.px, xticks = false, yticks = false, @@ -395,7 +396,7 @@ function compute_mse( push!(table_best_mse, best_mse[tc_var]) end - save_plots(plot_dir, plots_dict; group_figs = group_figs, have_tc_main = have_tc_main, fig_height = fig_height) + save_plots(plot_dir, plots_dict; group_figs, have_tc_main, fig_height, case_name) # Tabulate output header = [ @@ -413,7 +414,7 @@ function compute_mse( mse_reductions, ) - @info @sprintf("Experiment comparison: %s at time t=%s\n", experiment, t_cmp) + @info @sprintf("case_name comparison: %s at time t=%s\n", case_name, t_cmp) hl_worsened_mse = Highlighter((data, i, j) -> !sufficient_mse(data[i, 6], data[i, 7]) && j == 6, crayon"red bold") hl_worsened_mse_reduction = Highlighter((data, i, j) -> !sufficient_mse(data[i, 6], data[i, 7]) && j == 8, crayon"red bold") @@ -431,7 +432,7 @@ function compute_mse( return mse end -function save_plots(plot_dir, plots_dict; group_figs = true, have_tc_main, fig_height) +function save_plots(plot_dir, plots_dict; group_figs = true, have_tc_main, fig_height, case_name) vars_to_skip = [ "thetal_mean", "updraft_thetal", @@ -455,7 +456,24 @@ function save_plots(plot_dir, plots_dict; group_figs = true, have_tc_main, fig_h n_cols = 1 n_rows = ceil(Int, n_plots / n_cols) @info " Saving $(joinpath(plot_dir, "contours.png"))" - Plots.plot(all_contours...; layout = (n_rows, n_cols), framestyle = :box, margin = 20 * Plots.PlotMeasures.px) + title = Plots.plot( + title = case_name, + grid = false, + showaxis = false, + xticks = false, + yticks = false, + bottom_margin = -20 * Plots.PlotMeasures.px, + ) + layout = Plots.@layout [a{0.01h}; Plots.grid(n_rows, n_cols)] + + Plots.plot( + title, + all_contours...; + layout = layout, + framestyle = :box, + margin = 20 * Plots.PlotMeasures.px, + dpi = 200, + ) Plots.savefig(joinpath(plot_dir, "contours.png")) width_to_height_ratio = 15 / 10 @@ -470,14 +488,15 @@ function save_plots(plot_dir, plots_dict; group_figs = true, have_tc_main, fig_h for (k, I) in enumerate(CartesianIndices((1:n_cols, 1:n_rows))) k > length(all_profiles) && continue j, i = (Tuple(I)...,) - if j == 1 + if j == 1 # left plots Plots.plot!( all_profiles[k], + left_margin = 50 * Plots.PlotMeasures.px, bottom_margin = -2 * Plots.PlotMeasures.px, right_margin = -2 * Plots.PlotMeasures.px, top_margin = -2 * Plots.PlotMeasures.px, ) - elseif j == n_cols + elseif j == n_cols # right plots Plots.plot!( all_profiles[k], yticks = false, @@ -487,7 +506,7 @@ function save_plots(plot_dir, plots_dict; group_figs = true, have_tc_main, fig_h right_margin = -2 * Plots.PlotMeasures.px, top_margin = -2 * Plots.PlotMeasures.px, ) - else # middle plot + else # middle plots Plots.plot!( all_profiles[k], yticks = false, @@ -499,12 +518,23 @@ function save_plots(plot_dir, plots_dict; group_figs = true, have_tc_main, fig_h ) end end + title = Plots.plot( + title = case_name, + grid = false, + showaxis = false, + xticks = false, + yticks = false, + bottom_margin = -20 * Plots.PlotMeasures.px, + ) + layout = Plots.@layout [a{0.01h}; Plots.grid(n_rows, n_cols)] Plots.plot( + title, all_profiles...; - layout = Plots.grid(n_rows, n_cols), + layout = layout, size = (width_to_height_ratio * fig_height, fig_height), framestyle = :box, margin = 20 * Plots.PlotMeasures.px, + dpi = 200, ) Plots.savefig(joinpath(plot_dir, "profiles.png")) else