def build_new_graph(figure, figure_structure, graph_position, graph_layout,
    dataframe):
    """Builds a new matplotlib graph in the provided matplotlib
    figure thanks to the provided parameters

    Input:
    ------
    figure : matplotlib object
    figure_structure : tuple of 2 integers
    graph_position : integer
    graph_layout : nested object
    dataframe : pandas data frame
    """
    subplot = figure.add_subplot(*figure_structure, graph_position)
    if 'x_label' in graph_layout:
        subplot.set_xlabel(graph_layout['x_label'])
    if 'y_label' in graph_layout:
        subplot.set_ylabel(graph_layout['y_label'])
    if 'title' in graph_layout:
        subplot.set_title(graph_layout['title'], fontweight='bold')
    if graph_layout['x_var'] in dataframe.keys():
        for curve_layout in graph_layout['curves']:
            if curve_layout['var'] in dataframe.keys():
                if 'legend' in curve_layout:
                    curve_legend = curve_layout['legend']
                else:
                    curve_legend = curve_layout['var']
                subplot.plot(dataframe[graph_layout['x_var']], dataframe[
                    curve_layout['var']], label=curve_legend)
    subplot.legend(loc='upper right')
