From c22ea073216bd09e7da93a1618f07b9a0afb81c2 Mon Sep 17 00:00:00 2001 From: Le Roux Erwan <erwan.le-roux@irstea.fr> Date: Wed, 9 Sep 2020 18:24:13 +0200 Subject: [PATCH] [contrasting] final odifications for the second round of review for NHESS --- .../visualization/study_visualizer.py | 14 ++++++++++---- .../main_comparison_with_eurocode_global.py | 8 +++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/extreme_data/meteo_france_data/scm_models_data/visualization/study_visualizer.py b/extreme_data/meteo_france_data/scm_models_data/visualization/study_visualizer.py index 037dcbff..20885487 100644 --- a/extreme_data/meteo_france_data/scm_models_data/visualization/study_visualizer.py +++ b/extreme_data/meteo_france_data/scm_models_data/visualization/study_visualizer.py @@ -339,7 +339,8 @@ class StudyVisualizer(VisualizationParameters): def visualize_max_graphs_poster(self, massif_name, altitude, snow_abbreviation, color, label=None, last_plot=True, ax=None, linestyle=None, - tight_pad=None, dpi=None, linewidth=5): + tight_pad=None, dpi=None, linewidth=5, + legend_size=None): massif_names = self.study.study_massif_names # Display the graph of the max on top if ax is None: @@ -355,12 +356,17 @@ class StudyVisualizer(VisualizationParameters): ax.tick_params(axis='both', which='major', labelsize=13) plot_name = 'Annual maxima of {} in {} at {}m'.format(snow_abbreviation, massif_name, altitude) self.plot_name = plot_name - ax.set_ylabel('{} ({})'.format(snow_abbreviation, self.study.variable_unit), fontsize=15) - ax.set_xlabel('years', fontsize=15) + fontsize = 15 + ax.set_ylabel('{} ({})'.format(snow_abbreviation, self.study.variable_unit), fontsize=fontsize) + ax.set_xlabel('years', fontsize=fontsize) if label is None and massif_name is not None: ax.set_title('{} at {} m'.format(massif_name, altitude)) if last_plot: - ax.legend() + if legend_size is None: + ax.legend() + else: + ax.legend(prop={'size': legend_size}) + self.show_or_save_to_file(add_classic_title=False, no_title=True, tight_layout=True, tight_pad=tight_pad, diff --git a/projects/exceeding_snow_loads/section_discussion/main_comparison_with_eurocode_global.py b/projects/exceeding_snow_loads/section_discussion/main_comparison_with_eurocode_global.py index 8ee2cf45..1d09d8ef 100644 --- a/projects/exceeding_snow_loads/section_discussion/main_comparison_with_eurocode_global.py +++ b/projects/exceeding_snow_loads/section_discussion/main_comparison_with_eurocode_global.py @@ -42,6 +42,8 @@ def max_graph_annual_maxima_comparison(): ('mediumpurple', 2700), ][:] ax = plt.gca() + legend_size = 14 + for color, altitude in marker_altitude: for study in study_iterator_global([study_class], altitudes=[altitude]): study_visualizer = StudyVisualizer(study, save_to_file=save_to_file, @@ -49,9 +51,9 @@ def max_graph_annual_maxima_comparison(): multiprocessing=True) snow_abbreviation = SCM_STUDY_CLASS_TO_ABBREVIATION[study_class] nb_massifs = len(study_visualizer.study.study_massif_names) - label = 'Mean value at {}m (out of {} massifs)'.format(altitude, nb_massifs) + label = 'Mean at {}m ({} massifs)'.format(altitude, nb_massifs) study_visualizer.visualize_max_graphs_poster(None, altitude, snow_abbreviation, color, label, - False, ax) + False, ax, legend_size=legend_size) last_plot = altitude == 2700 if last_plot: @@ -59,7 +61,7 @@ def max_graph_annual_maxima_comparison(): # label = '{} for French standards'.format(snow_density_str) # snow_density_eurocode = [150 for _ in study.ordered_years] # ax.plot(study.ordered_years, snow_density_eurocode, color='k', label=label) - ax.legend() + ax.legend(prop={'size': legend_size}) tight_pad = {'h_pad': 0.2} ax.set_ylim(ylim) ax.set_xlim([1957, 2018]) -- GitLab