def lineplot(self,
                 column_name_draw,
                 column_name_true_values=None,
                 envelope_flag=True,
                 separators_plot=None,
                 palette='PuOr',
                 hue=None,
                 style=None,
                 markers=None,
                 sizes=None,
                 dict_plot_for_main_line={},
                 path_save_plot=None,
                 list_aplots=None,
                 *args,
                 **kwargs):
        """
        Semantics:
            Draw the lineplot.
            Issue with seaborn:
                When writing overloading, always draw before using super().
                Otherwise, the legend is not actualised.
                If it is, then seaborn's style in the legend will be erased.

        Args:
            column_name_draw (str): The column of the dataframe used to retrieve the data to draw
            column_name_true_values (str): The column where true values are present
            envelope_flag (bool): Flag to specify whether or not to draw the min and max of the data
            separators_plot (list of str): List of columns to group by, this will generate a plot for the product of unique
                elements in each column
            palette (colors of seaborn): colors for hue. Some example in priv_lib_plot/acolor/colors_seaborn.py
            hue (str): The column used in order to draw multiple lines on the same plot for the data,
                discriminating by this column
            style (str): separator for line and marker style.
            markers (bool):
            sizes:
            dict_plot_for_main_line (dict): additional parameters for the plot (evolution line).
            path_save_plot (str): Path to specify where the plot should be saved. Not saved if is None.
            list_aplots (list of Aplot): Plot for plotting.
                There should be as many axs as in the number of groups given by separators_plotters
                 (with the grouping_by parameter of the plot_estimator).
            kwargs: passed to super and to get_dict_fig.

        Returns:

        Dependency:
            todo write the dependency

        """
        # super call for gathering all separators together and having the group by done.
        separators_plot, global_dict, keys = super().draw(
            separators_plot=separators_plot, *args, **kwargs)
        self._raise_if_separator_is_evolution(
            separators_plot)  # test evolution_name is not part of separators.

        current_plots = list_aplots if list_aplots is not None else [
        ]  # fetch the aplots of create an empty list
        current_keys = [
        ]  # we return current_keys which is the list version of keys, in the iteration order.
        for i, key in enumerate(keys):
            if key is None:  # case where we cannot use groupby.
                data = global_dict
                separators_plot = ["data used"]  # for the title
                key = ["whole dataset"]  # for the title
            else:
                data = global_dict.get_group(key)
            # TODO 13/07/2021 nie_k:  is key necessarly iterable? what if there is only one key? (i.e. not 0 or 3...?)
            current_keys.append(key)

            # creation of the plot
            # choice of ax
            if list_aplots is not None:
                # TODO 27/06/2021 nie_k:  verify plots is same length as keys.
                aplot = list_aplots[i]
                ax = aplot._axs[i]
            else:
                aplot = APlot()
                current_plots.append(aplot)
                ax = aplot._axs[0]
            sns.lineplot(x=self.EVOLUTION_COLUMN,
                         y=column_name_draw,
                         hue=hue,
                         style=style,
                         sizes=sizes,
                         markers=markers,
                         legend='full',
                         ci=95,
                         err_style="band",
                         palette=palette,
                         data=data,
                         ax=ax,
                         **dict_plot_for_main_line)

            if envelope_flag:
                for fct in ['min', 'max']:
                    sns.lineplot(
                        x=self.EVOLUTION_COLUMN,
                        y=column_name_draw,
                        estimator=fct,
                        hue=hue,
                        legend=False,
                        err_style="band",
                        ci=None,
                        # no Conf. Inter. for max value (does not make actually sense with bootstrapping)
                        palette=palette,
                        data=data,
                        ax=ax,
                        color='r',
                        linestyle='--',
                        linewidth=0.5,
                        label=fct)
            if column_name_true_values is not None:
                sns.lineplot(x=self.EVOLUTION_COLUMN,
                             y=column_name_true_values,
                             hue=hue,
                             legend=False,
                             err_style="band",
                             ci=None,
                             palette=palette,
                             data=data,
                             ax=ax,
                             color='r',
                             linestyle='--',
                             linewidth=0.5,
                             label='true value')

            # TODO 01/07/2021 nie_k:  is there a way to retrieve the complete legend, with annotations?
            fig_dict = self.get_dict_fig(separators_plot, key, **kwargs)
            aplot.set_dict_ax(0, fig_dict)

            super()._saveplot(aplot, path_save_plot, 'relplot_', key)
        return current_plots, current_keys
    def scatter(self,
                column_name_draw,
                column_name_true_values=None,
                separators_plot=None,
                palette='PuOr',
                hue=None,
                style=None,
                markers=None,
                sizes=None,
                dict_plot_for_main_line={},
                path_save_plot=None,
                *args,
                **kwargs):
        # TODO 27/06/2021 nie_k:  add the ax parameter as it is in line plot.
        """
        Semantics:
            Draw the scatterplot.
            Issue with seaborn:
                When writing overloading, always draw before using super().
                Otherwise, the legend is not actualised.
                If it is, then seaborn's style in the legend will be erased.

        Args:
            column_name_draw (str): The column of the dataframe used to retrieve the data to draw
            column_name_true_values (str): The column where true values are present
            separators_plot (list of str): List of columns to group by, this will generate a plot for the product of unique
                elements in each column
            palette (colors of seaborn): colors for hue. Some example in priv_lib_plot/acolor/colors_seaborn.py
            hue (str): The column used in order to draw multiple lines on the same plot for the data,
                discriminating by this column
            style (str): separator for marker style
            markers (bool):
            sizes:
            dict_plot_for_main_line (dict): additional parameters for the plot (evolution line).
            path_save_plot (str): Path to specify where the plot should be saved. Not saved if is None.

        Returns:

        Dependency:
            todo write the dependency
        """
        # super call for gathering all separators together and having the group by done.
        separators_plot, global_dict, keys = super().draw(
            separators_plot=separators_plot, *args, **kwargs)
        self._raise_if_separator_is_evolution(
            separators_plot)  # test evolution_name is not part of separators.
        plots = []
        for key in keys:
            if key is None:  # case where we cannot use groupby.
                data = global_dict
                separators_plot = ["data used"]  # for title
                key = ["whole dataset"]  # for title
            else:
                data = global_dict.get_group(key)
            # creation of the plot
            plot = APlot()
            plots.append(plot)

            sns.scatterplot(x=self.EVOLUTION_COLUMN,
                            y=column_name_draw,
                            hue=hue,
                            style=style,
                            sizes=sizes,
                            markers=markers,
                            legend='full',
                            palette=palette,
                            data=data,
                            ax=plot._axs[0],
                            **dict_plot_for_main_line)

            if column_name_true_values is not None:
                sns.lineplot(x=self.EVOLUTION_COLUMN,
                             y=column_name_true_values,
                             hue=hue,
                             legend=False,
                             palette=palette,
                             data=data,
                             ax=plot._axs[0],
                             color='r',
                             linestyle='--',
                             linewidth=0.5,
                             label='true value',
                             **dict_plot_for_main_line)

            fig_dict = self.get_dict_fig(separators_plot, key, **kwargs)
            plot.set_dict_ax(0, fig_dict)

            if path_save_plot is not None:
                # TODO 23/06/2021 nie_k:  PROBLEM WHEN KEY IS NONE Le chemin d’accès spécifié est introuvable: ''
                # TODO 26/06/2021 nie_k: refactor function using path_save_plot + fct. LIKE PARAMETER + KEYS + NAME FCT (hist, scatter, lineplot...)
                name_file = ''.join(
                    [function_str.tuple_to_str(key, ''), 'evol_estimation'])
                plot.save_plot(name_save_file=name_file)
        return plots
    def hist(self,
             column_name_draw,
             separators_plot=None,
             separators_filter=None,
             palette='PuOr',
             hue=None,
             bins=20,
             binrange=None,
             stat='count',
             multiple="stack",
             kde=False,
             path_save_plot=None):
        """
        Semantics:
            histogram plot.
            Issue with seaborn:
                When writing overloading, always draw before using super().
                Otherwise, the legend is not actualised.
                If it is, then seaborn's style in the legend will be erased.

        Args:
            column_name_draw:
            separators_plot:
            separators_filter:
            palette:
            hue:
            bins:
            binrange (pair): borns of the ax.
            stat: Aggregate statistic to compute in each bin.
                'count' shows the number of observations.
                'frequency' shows the number of observations divided by the bin width.
                'density' normalizes counts so that the area of the histogram is 1.
                'probability' normalizes counts so that the sum of the bar heights is 1.
            multiple: Approach to resolving multiple elements when semantic mapping creates subsets.
                {“layer”, “dodge”, “stack”, “fill”}
            kde (bool): If True, compute a kernel density estimate to smooth the distribution and show on the plot as (one or more) line(s). Only relevant with univariate data.
            path_save_plot:

        Returns:

        """
        # super call for gathering all separators together and having the group by done.
        separators, global_dict, keys = super().draw(
            separators_plot=separators_plot)
        keys = filter(separators, keys, separators_filter)
        plots = []
        for key in keys:
            if key is None:  # case where we cannot use groupby.
                data = global_dict
                separators = ["data used"]
                key = ["whole dataset"]  # for the title
            else:
                data = global_dict.get_group(key)

            plot = APlot()
            plots.append(plot)

            # get the good palette (sliced avoiding white.
            palette = self.color_scheme(palette)

            sns.histplot(x=column_name_draw,
                         bins=bins,
                         hue=hue,
                         multiple=multiple,
                         binrange=binrange,
                         legend='full',
                         kde=kde,
                         palette=palette,
                         data=data,
                         ax=plot._axs[0],
                         stat=stat)
            fig_dict = self.get_dict_fig(separators, key)
            plot.set_dict_ax(0, fig_dict)

            if path_save_plot is not None:
                name_file = ''.join(
                    [function_str.tuple_to_str(key, ''), 'evol_estimation'])
                plot.save_plot(name_save_file=name_file)
        return plots