From 5456da1fcac94e5ea8131072b45eb7b4d6eb2a18 Mon Sep 17 00:00:00 2001
From: Le Roux Erwan <erwan.le-roux@irstea.fr>
Date: Thu, 7 Jan 2021 14:53:47 +0100
Subject: [PATCH] [contrasting] change reference altititudes. change cmap for
 the plots. change axis for the preliminary plots.

---
 .../visualization/create_shifted_cmap.py      | 25 +++++-
 .../visualization/plot_utils.py               |  7 +-
 .../altitudes_fit/altitudes_studies.py        |  2 +-
 .../altitudes_fit/main_altitudes_studies.py   |  2 +-
 .../one_fold_analysis/altitude_group.py       |  6 +-
 ...es_visualizer_for_non_stationary_models.py | 20 +++--
 .../one_fold_analysis/plot_total_aic.py       |  2 +-
 .../plots/plot_coherence_curves.py            |  7 +-
 .../plots/plot_histogram_altitude_studies.py  | 26 ++++---
 .../preliminary_analysis.py                   | 78 +++++++++++++------
 10 files changed, 121 insertions(+), 54 deletions(-)

diff --git a/extreme_data/meteo_france_data/scm_models_data/visualization/create_shifted_cmap.py b/extreme_data/meteo_france_data/scm_models_data/visualization/create_shifted_cmap.py
index c0fbb7fb..c6ad676b 100644
--- a/extreme_data/meteo_france_data/scm_models_data/visualization/create_shifted_cmap.py
+++ b/extreme_data/meteo_france_data/scm_models_data/visualization/create_shifted_cmap.py
@@ -4,7 +4,7 @@ import matplotlib.cm as cm
 import matplotlib.colorbar as cbar
 import matplotlib.pyplot as plt
 import numpy as np
-from matplotlib.colors import LinearSegmentedColormap
+from matplotlib.colors import LinearSegmentedColormap, ListedColormap
 from mpl_toolkits.axes_grid1 import make_axes_locatable
 
 from extreme_fit.distribution.abstract_params import AbstractParams
@@ -24,12 +24,24 @@ def get_shifted_map(vmin, vmax, cmap=plt.cm.bwr):
     shifted_cmap = shiftedColorMap(cmap, midpoint=midpoint, name='shifted')
     return shifted_cmap
 
+def remove_the_extreme_colors(cmap, epsilon=0.05):
+    epsilon = epsilon
+    colors = cmap(np.linspace(epsilon, 1-epsilon, cmap.N))
+    return LinearSegmentedColormap.from_list('without extreme', colors)
+
+def get_inverse_colormap(cmap):
+    colors = cmap(np.linspace(1, 0, cmap.N))
+    return LinearSegmentedColormap.from_list('Inverse', colors)
+
+def get_cmap_with_inverted_blue_and_green_channels(cmap):
+    colors = cmap(np.linspace(0, 1, cmap.N))
+    colors = [[c[0], c[2], c[1], c[3]] for c in colors]
+    return LinearSegmentedColormap.from_list('Inverted channels', colors)
 
 def get_half_colormap(cmap):
     colors = cmap(np.linspace(0.5, 1, cmap.N // 2))
     # Create a new colormap from those colors
-    cmap2 = LinearSegmentedColormap.from_list('Upper Half', colors)
-    return cmap2
+    return LinearSegmentedColormap.from_list('Upper Half', colors)
 
 
 def create_colorbase_axis(ax, label, cmap, norm, ticks_values_and_labels=None, fontsize=15):
@@ -180,3 +192,10 @@ def shiftedColorMap(cmap, start=0, midpoint=0.5, stop=1.0, name='shiftedcmap'):
     plt.register_cmap(cmap=newcmap)
 
     return newcmap
+
+
+if __name__ == '__main__':
+    cmap = plt.cm.bwr
+    cmap = get_inverse_colormap(cmap)
+    cmap = remove_the_extreme_colors(cmap)
+    cmap = get_cmap_with_inverted_blue_and_green_channels(cmap)
diff --git a/extreme_data/meteo_france_data/scm_models_data/visualization/plot_utils.py b/extreme_data/meteo_france_data/scm_models_data/visualization/plot_utils.py
index ecab9092..33138dcc 100644
--- a/extreme_data/meteo_france_data/scm_models_data/visualization/plot_utils.py
+++ b/extreme_data/meteo_france_data/scm_models_data/visualization/plot_utils.py
@@ -7,7 +7,8 @@ from extreme_data.meteo_france_data.scm_models_data.visualization.create_shifted
     get_half_colormap
 
 
-def plot_against_altitude(x_ticks, ax, massif_id, massif_name, values, altitude=None, fill=False, massif_name_as_labels=True):
+def plot_against_altitude(x_ticks, ax, massif_id, massif_name, values, altitude=None, fill=False, massif_name_as_labels=True,
+                          elevation_as_xaxis=True):
     if massif_name_as_labels:
         di = massif_id // 8
         if di == 0:
@@ -27,8 +28,10 @@ def plot_against_altitude(x_ticks, ax, massif_id, massif_name, values, altitude=
         linestyle = None
         label = '{} m'.format(altitude)
     if not fill:
-        ax.plot(x_ticks, values, color=color, linewidth=2, label=label, linestyle=linestyle, marker='o')
+        args = [x_ticks, values] if elevation_as_xaxis else [values, x_ticks]
+        ax.plot(*args, color=color, linewidth=2, label=label, linestyle=linestyle, marker='o')
     else:
+        assert elevation_as_xaxis, NotImplementedError('todo')
         lower_bound, upper_bound = zip(*values)
         # ax.fill_between(altitudes, lower_bound, upper_bound, color=color, alpha=0.2, label=label + '95\% confidence interval')
         ax.fill_between(x_ticks, lower_bound, upper_bound, color=color, alpha=0.2)
diff --git a/projects/altitude_spatial_model/altitudes_fit/altitudes_studies.py b/projects/altitude_spatial_model/altitudes_fit/altitudes_studies.py
index 2cdcdba4..d4ce3b54 100644
--- a/projects/altitude_spatial_model/altitudes_fit/altitudes_studies.py
+++ b/projects/altitude_spatial_model/altitudes_fit/altitudes_studies.py
@@ -148,7 +148,7 @@ class AltitudesStudies(object):
         plot_name = 'Annual maxima of {} in {}'.format(STUDY_CLASS_TO_ABBREVIATION[self.study_class],
                                                        massif_name.replace('_', ' '))
         ax.set_ylabel('{} ({})'.format(plot_name, self.study.variable_unit), fontsize=15)
-        ax.set_xlabel('years', fontsize=15)
+        # ax.set_xlabel('years', fontsize=15)
         plot_name = 'time series/' + plot_name
         self.show_or_save_to_file(plot_name=plot_name, show=show, no_title=True, tight_layout=True)
         ax.clear()
diff --git a/projects/altitude_spatial_model/altitudes_fit/main_altitudes_studies.py b/projects/altitude_spatial_model/altitudes_fit/main_altitudes_studies.py
index 4fdf8295..0532fa44 100644
--- a/projects/altitude_spatial_model/altitudes_fit/main_altitudes_studies.py
+++ b/projects/altitude_spatial_model/altitudes_fit/main_altitudes_studies.py
@@ -66,7 +66,7 @@ def plot_visualizers(massif_names, visualizer_list):
 def plot_visualizer(massif_names, visualizer):
     # Plot time series
     # visualizer.studies.plot_maxima_time_series(massif_names)
-    visualizer.studies.plot_maxima_time_series(['Vanoise'])
+    # visualizer.studies.plot_maxima_time_series(['Vanoise'])
 
     # Plot the results for the model that minimizes the individual aic
     plot_individual_aic(visualizer)
diff --git a/projects/altitude_spatial_model/altitudes_fit/one_fold_analysis/altitude_group.py b/projects/altitude_spatial_model/altitudes_fit/one_fold_analysis/altitude_group.py
index 9b09d5ab..30d0eb09 100644
--- a/projects/altitude_spatial_model/altitudes_fit/one_fold_analysis/altitude_group.py
+++ b/projects/altitude_spatial_model/altitudes_fit/one_fold_analysis/altitude_group.py
@@ -70,7 +70,7 @@ class LowAltitudeGroup(AbstractAltitudeGroup):
 
     @property
     def reference_altitude(self):
-        return 600
+        return 500
 
 
 class MidAltitudeGroup(AbstractAltitudeGroup):
@@ -108,7 +108,7 @@ class HighAltitudeGroup(AbstractAltitudeGroup):
 
     @property
     def reference_altitude(self):
-        return 2400
+        return 2500
 
 
 class VeyHighAltitudeGroup(AbstractAltitudeGroup):
@@ -127,7 +127,7 @@ class VeyHighAltitudeGroup(AbstractAltitudeGroup):
 
     @property
     def reference_altitude(self):
-        return 3300
+        return 3500
 
 
 class DefaultAltitudeGroup(AbstractAltitudeGroup):
diff --git a/projects/altitude_spatial_model/altitudes_fit/one_fold_analysis/altitudes_studies_visualizer_for_non_stationary_models.py b/projects/altitude_spatial_model/altitudes_fit/one_fold_analysis/altitudes_studies_visualizer_for_non_stationary_models.py
index 7678bc8b..dc2a2beb 100644
--- a/projects/altitude_spatial_model/altitudes_fit/one_fold_analysis/altitudes_studies_visualizer_for_non_stationary_models.py
+++ b/projects/altitude_spatial_model/altitudes_fit/one_fold_analysis/altitudes_studies_visualizer_for_non_stationary_models.py
@@ -10,7 +10,8 @@ from cached_property import cached_property
 
 from extreme_data.meteo_france_data.scm_models_data.abstract_study import AbstractStudy
 from extreme_data.meteo_france_data.scm_models_data.visualization.create_shifted_cmap import get_shifted_map, \
-    get_colors, ticks_values_and_labels_for_percentages, get_half_colormap, ticks_values_and_labels_for_positive_value
+    get_colors, ticks_values_and_labels_for_percentages, get_half_colormap, ticks_values_and_labels_for_positive_value, \
+    get_inverse_colormap, get_cmap_with_inverted_blue_and_green_channels, remove_the_extreme_colors
 from extreme_data.meteo_france_data.scm_models_data.visualization.main_study_visualizer import \
     SCM_STUDY_CLASS_TO_ABBREVIATION, ALL_ALTITUDES_WITHOUT_NAN
 from extreme_data.meteo_france_data.scm_models_data.visualization.plot_utils import plot_against_altitude
@@ -93,10 +94,11 @@ class AltitudesStudiesVisualizerForNonStationaryModels(StudyVisualizer):
         return massif_altitudes
 
     def load_condition(self, massif_altitudes):
-        # At least two altitudes for the estimated, including the reference altitude
-        reference_altitude_is_in_altitudes = (self.altitude_group.reference_altitude in massif_altitudes)
+        # At least two altitudes for the estimated
+        # reference_altitude_is_in_altitudes = (self.altitude_group.reference_altitude in massif_altitudes)
         at_least_two_altitudes = (len(massif_altitudes) >= 2)
-        return reference_altitude_is_in_altitudes and at_least_two_altitudes
+        # return reference_altitude_is_in_altitudes and at_least_two_altitudes
+        return at_least_two_altitudes
 
     @property
     def massif_name_to_one_fold_fit(self) -> Dict[str, OneFoldFit]:
@@ -160,19 +162,27 @@ class AltitudesStudiesVisualizerForNonStationaryModels(StudyVisualizer):
 
         is_return_level_plot = (self.moment_names.index(method_name) == 0) and (order is None)
         if is_return_level_plot:
+            cmap = plt.cm.Spectral
+            cmap = remove_the_extreme_colors(cmap, epsilon=0.25)
+            cmap = get_inverse_colormap(cmap)
             add_colorbar = True
             max_abs_change = None
             massif_name_to_text = {m: round(v) for m, v in massif_name_to_value.items()}
             graduation = self.altitude_group.graduation_for_return_level
             fontsize_label = 17
         else:
+            # cmap = plt.cm.RdYlGn
+            cmap = [plt.cm.coolwarm, plt.cm.bwr, plt.cm.seismic][2]
+            cmap = get_inverse_colormap(cmap)
+            cmap = get_cmap_with_inverted_blue_and_green_channels(cmap)
+            cmap = remove_the_extreme_colors(cmap)
             graduation = 10
             fontsize_label = 10
 
         negative_and_positive_values = self.moment_names.index(method_name) > 0
         # Plot the map
 
-        self.plot_map(cmap=plt.cm.coolwarm, graduation=graduation,
+        self.plot_map(cmap=cmap, graduation=graduation,
                       label=ylabel, massif_name_to_value=massif_name_to_value,
                       plot_name=plot_name, add_x_label=True,
                       negative_and_positive_values=negative_and_positive_values,
diff --git a/projects/altitude_spatial_model/altitudes_fit/one_fold_analysis/plot_total_aic.py b/projects/altitude_spatial_model/altitudes_fit/one_fold_analysis/plot_total_aic.py
index 6ebcbd94..45120d24 100644
--- a/projects/altitude_spatial_model/altitudes_fit/one_fold_analysis/plot_total_aic.py
+++ b/projects/altitude_spatial_model/altitudes_fit/one_fold_analysis/plot_total_aic.py
@@ -14,7 +14,7 @@ from projects.exceeding_snow_loads.utils import dpi_paper1_figure
 
 
 def plots(visualizer: AltitudesStudiesVisualizerForNonStationaryModels):
-    # visualizer.plot_shape_map()
+    visualizer.plot_shape_map()
     visualizer.plot_moments()
     # visualizer.plot_qqplots()
     # for std in [True, False]:
diff --git a/projects/altitude_spatial_model/altitudes_fit/plots/plot_coherence_curves.py b/projects/altitude_spatial_model/altitudes_fit/plots/plot_coherence_curves.py
index 06764d38..87cdf9ae 100644
--- a/projects/altitude_spatial_model/altitudes_fit/plots/plot_coherence_curves.py
+++ b/projects/altitude_spatial_model/altitudes_fit/plots/plot_coherence_curves.py
@@ -25,8 +25,9 @@ def plot_coherence_curves(massif_names, visualizer_list: List[AltitudesStudiesVi
             if i % 2 == 1:
                 ax.set_yticks([])
         axes = [ax if i % 2 == 0 else ax.twinx() for i, ax in enumerate(axes)]
-        colors = ['tab:orange', 'blue', 'green']
-        labels = ['Elevational-temporal model in 1959', 'Elevational-temporal model in 2019', 'Pointwise distribution']
+        colors = ['blue', 'red', 'green']
+        elevational_str = 'Piecewise elevational-temporal models in'
+        labels = ['{} 1959'.format(elevational_str), '{} 2019'.format(elevational_str), 'Pointwise distributions']
         altitudinal_model = [True, True, False]
         years = [1959, 2019, None]
         for color, global_label, boolean, year in list(zip(colors, labels, altitudinal_model, years))[:]:
@@ -76,7 +77,7 @@ def plot_coherence_curve(axes, massif_name, visualizer_list: List[AltitudesStudi
                 if len(bounds) > 0:
                     lower_bound, upper_bound = bounds
                     if legend and not legend_line:
-                        model_name = 'elevational-temporal model in 2019' if is_altitudinal else 'pointwise distribution'
+                        model_name = 'piecewise elevational-temporal models in 2019' if is_altitudinal else 'pointwise distributions'
                         fill_label = "95\% confidence interval for the {}".format(model_name) if j == 0 else None
                         ax.fill_between(x_list, lower_bound, upper_bound, color=color, alpha=0.2, label=fill_label)
                     else:
diff --git a/projects/altitude_spatial_model/altitudes_fit/plots/plot_histogram_altitude_studies.py b/projects/altitude_spatial_model/altitudes_fit/plots/plot_histogram_altitude_studies.py
index 2def3c39..30a3635e 100644
--- a/projects/altitude_spatial_model/altitudes_fit/plots/plot_histogram_altitude_studies.py
+++ b/projects/altitude_spatial_model/altitudes_fit/plots/plot_histogram_altitude_studies.py
@@ -84,29 +84,33 @@ def plot_histogram_all_trends_against_altitudes(massif_names, visualizer_list: L
 
     plt.close()
     ax = plt.gca()
-    width = 5
+    width = 6
     size = 10
     legend_fontsize = 15
     labelsize = 10
     linewidth = 3
     x = np.array([3 * width * (i + 1) for i in range(len(nb_massifs))])
 
-    colors = ['blue', 'darkblue', 'red', 'darkred']
+    # colors = ['blue', 'darkblue', 'red', 'darkred']
+    colors = ['red', 'darkred', 'limegreen', 'darkgreen']
     labels = []
-    for suffix in ['Decrease', 'Increase']:
+    for suffix in ['decrease', 'increase']:
         for prefix in ['Non significant', 'Significant']:
             labels.append('{} {}'.format(prefix, suffix))
     for l, color, label in zip(all_l, colors, labels):
-        x_shifted = x - width / 2 if 'blue' in color else x + width / 2
+        shift = 0.6 * width
+        is_a_decrease_plot = colors.index(color) in [0, 1]
+        x_shifted = x - shift if is_a_decrease_plot else x + shift
         ax.bar(x_shifted, l, width=width, color=color, edgecolor=color, label=label,
-               linewidth=linewidth)
+               linewidth=linewidth, align='center')
     ax.legend(loc='upper left', prop={'size': size})
     ax.set_ylabel('Percentage of massifs (\%) ', fontsize=legend_fontsize)
     ax.set_xlabel('Elevation range', fontsize=legend_fontsize)
     ax.tick_params(axis='both', which='major', labelsize=labelsize)
     ax.set_xticks(x)
     ax.yaxis.grid()
-    ax.set_ylim(bottom=0)
+    ax.set_ylim([0, 69])
+    # ax.set_ylim(bottom=0)
     ax.set_xticklabels([v.altitude_group.formula_upper for v in visualizer_list])
 
     plot_nb_massif_on_upper_axis(ax, labelsize, legend_fontsize, nb_massifs, x)
@@ -126,7 +130,8 @@ def plot_shoe_plot_changes_against_altitude(massif_names, visualizer_list: List[
     all_changes = list(zip(*all_changes))
     labels = ['All massifs', 'Massifs with a selected model temporally non-stationary',
               'Massifs with a selected model temporally non-stationary and significant']
-    colors = ['darkgreen', 'forestgreen', 'limegreen']
+    # colors = ['darkmagenta', 'darkviolet', 'mediumorchid']
+    colors = ['mediumblue', 'royalblue', 'lightskyblue']
     nb_massifs = [len(v.get_valid_names(massif_names)) for v in visualizer_list]
 
     plt.close()
@@ -155,15 +160,14 @@ def plot_shoe_plot_changes_against_altitude(massif_names, visualizer_list: List[
             patch.set_facecolor(color)
 
     custom_lines = [Line2D([0], [0], color=color, lw=4) for color in colors]
-    loc = 'upper left'
-    ax.legend(custom_lines, labels, loc=loc)
+    ax.legend(custom_lines, labels, prop={'size': 8})
 
     start = 'Relative changes' if relative else 'Changes'
     unit = '\%' if relative else visualizer.study.variable_unit
     ax.set_ylabel('{} of {}-year return levels between 1959 and 2019 ({})'.format(start, OneFoldFit.return_period,
                                                                                   unit),
                   fontsize=legend_fontsize)
-    ax.set_xlabel('Elevation', fontsize=legend_fontsize + 5)
+    ax.set_xlabel('Elevation (m)', fontsize=legend_fontsize + 5)
     ax.tick_params(axis='both', which='major', labelsize=labelsize)
     ax.set_xticks(x)
     ax.yaxis.grid()
@@ -173,7 +177,7 @@ def plot_shoe_plot_changes_against_altitude(massif_names, visualizer_list: List[
 
     shift = 2 * width
     ax.set_xlim((min(x) - shift, max(x) + shift))
-    upper_limit_for_legend = 30 if relative else 0
+    upper_limit_for_legend = 0 if relative else 0
     lim_down, lim_up = ax.get_ylim()
     ax.set_ylim(lim_down, lim_up + upper_limit_for_legend)
 
diff --git a/projects/altitude_spatial_model/preliminary_analysis.py b/projects/altitude_spatial_model/preliminary_analysis.py
index 935e2728..679f99a8 100644
--- a/projects/altitude_spatial_model/preliminary_analysis.py
+++ b/projects/altitude_spatial_model/preliminary_analysis.py
@@ -26,6 +26,7 @@ class PointwiseGevStudyVisualizer(AltitudesStudies):
 
     def plot_gev_params_against_altitude(self):
         legend = False
+        elevation_as_xaxis = False
         param_names = GevParams.PARAM_NAMES + [100]
         if legend:
             param_names = param_names[:1]
@@ -37,45 +38,74 @@ class PointwiseGevStudyVisualizer(AltitudesStudies):
             massif_names = self.study.all_massif_names()[:]
             for i in range(8):
                 for massif_name in massif_names[i::8]:
-                    linear_coef, _, r2 = self._plot_gev_params_against_altitude_one_massif(ax, massif_name, param_name)
+                    linear_coef, _, r2 = self._plot_gev_params_against_altitude_one_massif(ax, massif_name, param_name,
+                                                                                           elevation_as_xaxis)
                     massif_name_to_linear_coef[massif_name] = 100 * linear_coef[0]
                     massif_name_to_r2_score[massif_name] = str(round(r2, 2))
             print(param_name, np.mean([c for c in massif_name_to_linear_coef.values()]))
 
             # Display x label
-            xticks = [1000 * i for i in range(1, 4)]
-            ax.set_xticks(xticks)
+            elevation_ticks = [1000 * i for i in range(1, 4)]
+            if elevation_as_xaxis:
+                ax.set_xticks(elevation_ticks)
+            else:
+                ax.set_yticks(elevation_ticks)
             fontsize_label = 15
             ax.tick_params(labelsize=fontsize_label)
 
             # Compute the y label
             if param_name in GevParams.PARAM_NAMES:
-                ylabel = GevParams.full_name_from_param_name(param_name) + ' parameter'
+                value_label = GevParams.full_name_from_param_name(param_name) + ' parameter'
             else:
-                ylabel = '{}-year return levels'.format(param_name)
+                value_label = '{}-year return levels'.format(param_name)
             # Add units
             if param_name == GevParams.SHAPE:
                 unit = 'no unit'
             else:
                 unit = self.study.variable_unit
-            ylabel += ' ({})'.format(unit)
-
-            # Display the y label on the twin axis
-            if param_name in [100, GevParams.SCALE]:
-                ax2 = ax.twinx()
-                ax2.set_yticks(ax.get_yticks())
-                ax2.set_ylim(ax.get_ylim())
-                ax2.set_ylabel(ylabel, fontsize=fontsize_label)
+            value_label += ' ({})'.format(unit)
+            value_label = value_label.capitalize()
+
+            if elevation_as_xaxis:
+                # Display the y label on the twin axis
+                if param_name in [100, GevParams.SCALE]:
+                    ax2 = ax.twinx()
+                    ax2.set_yticks(ax.get_yticks())
+                    ax2.set_ylim(ax.get_ylim())
+                    ax2.set_ylabel(value_label, fontsize=fontsize_label)
+                    ax2.tick_params(labelsize=fontsize_label)
+                    ax.set_yticks([])
+                    tight_layout = False
+                else:
+                    ax.tick_params(labelsize=fontsize_label)
+                    tight_layout = True
+                    ax.set_ylabel(value_label, fontsize=fontsize_label)
+                # Make room for the ylabel
+                if param_name == 100:
+                    plt.gcf().subplots_adjust(right=0.85)
+            else:
+                if param_name in [GevParams.LOC, GevParams.SCALE]:
+                    ax2 = ax.twiny()
+                    ax2.set_xticks(ax.get_xticks())
+                    ax.set_xticks([])
+                else:
+                    ax2 = ax
+
+                ax2.set_xlim(ax.get_xlim())
+                ax2.set_xlabel(value_label, fontsize=fontsize_label)
                 ax2.tick_params(labelsize=fontsize_label)
-                ax.set_yticks([])
+
+                if param_name in [100, GevParams.SCALE]:
+                    ax3 = ax2.twinx()
+                    ax3.set_yticks(ax2.get_yticks())
+                    ax3.set_ylim(ax2.get_ylim())
+                    ax3.tick_params(labelsize=fontsize_label)
+                    ax2.set_yticks([])
+                    ax3.set_ylabel('Elevation (m)', fontsize=fontsize_label)
+                else:
+                    ax.set_ylabel('Elevation (m)', fontsize=fontsize_label)
+
                 tight_layout = False
-            else:
-                ax.tick_params(labelsize=fontsize_label)
-                tight_layout = True
-                ax.set_ylabel(ylabel, fontsize=fontsize_label)
-            # Make room for the ylabel
-            if param_name == 100:
-                plt.gcf().subplots_adjust(right=0.85)
 
             plot_name = '{} change with altitude'.format(param_name)
 
@@ -98,7 +128,7 @@ class PointwiseGevStudyVisualizer(AltitudesStudies):
             visualizer = StudyVisualizer(study=self.study, show=False, save_to_file=True)
             idx = 8 if param_name == GevParams.SHAPE else 1
             the = ' the' if param_name in GevParams.PARAM_NAMES else ''
-            label = 'Elevation gradient for\n{} {}'.format(the, ylabel[:-idx] + '/100m)')
+            label = 'Elevation gradient for\n{} {}'.format(the, value_label[:-idx] + '/100m)')
             gev_param_name_to_graduation = {
                 GevParams.LOC: 0.5,
                 GevParams.SCALE: 0.1,
@@ -118,7 +148,7 @@ class PointwiseGevStudyVisualizer(AltitudesStudies):
                                 )
             plt.close()
 
-    def _plot_gev_params_against_altitude_one_massif(self, ax, massif_name, param_name):
+    def _plot_gev_params_against_altitude_one_massif(self, ax, massif_name, param_name, elevation_as_xaxis):
         altitudes = []
         params = []
         # confidence_intervals = []
@@ -134,7 +164,7 @@ class PointwiseGevStudyVisualizer(AltitudesStudies):
                 params.append(param)
                 # confidence_intervals.append(gev_params.param_name_to_confidence_interval[param_name])
         massif_id = self.study.all_massif_names().index(massif_name)
-        plot_against_altitude(altitudes, ax, massif_id, massif_name, params, fill=False)
+        plot_against_altitude(altitudes, ax, massif_id, massif_name, params, fill=False, elevation_as_xaxis=elevation_as_xaxis)
 
         return fit_linear_regression(altitudes, params)
         # plot_against_altitude(altitudes, ax, massif_id, massif_name, confidence_intervals, fill=True)
-- 
GitLab