switch_model/tools/graph/main.py
def _create_axes(self, num_rows=1, size=(8, 5), ylabel=None, **kwargs):
        """
        Create a set of matplotlib axes
        """
        num_columns = 1 if self._is_multi_scenario_func else self.num_scenarios
        fig = GraphTools._create_figure(
            size=(size[0] * num_columns, size[1]),
            **kwargs
        )
        ax = fig.subplots(nrows=num_rows, ncols=num_columns, sharey='row', squeeze=False)

        ax = [[ax[j][i] for j in range(num_rows)] for i in range(num_columns)]

        # Set a title to each subplot
        for col, col_plots in enumerate(ax):
            for row, a in enumerate(col_plots):
                if num_columns > 1 and row == 0:
                    a.set_title(f"Scenario: {self._scenarios[col].name}")
                if ylabel is not None:
                    if type(ylabel) == str:
                        a.set_ylabel(ylabel)
                    else:
                        a.set_ylabel(ylabel[row])

        if num_rows == 1:
            ax = [ax[i][0] for i in range(num_columns)]

        return fig, ax

        Create a set of matplotlib axes
        
Create a set of matplotlib axes
Create a set of matplotlib axes
def _create_axes(self, num_rows=1, size=(8, 5), ylabel=None, **kwargs):
        num_columns = 1 if self._is_multi_scenario_func else self.num_scenarios
        fig = GraphTools._create_figure(
            size=(size[0] * num_columns, size[1]),
            **kwargs
        )
        ax = fig.subplots(nrows=num_rows, ncols=num_columns, sharey='row', squeeze=False)
        ax = [[ax[j][i] for j in range(num_rows)] for i in range(num_columns)]
        for col, col_plots in enumerate(ax):
            for row, a in enumerate(col_plots):
                if num_columns > 1 and row == 0:
                    a.set_title(f"Scenario: {self._scenarios[col].name}")
                if ylabel is not None:
                    if type(ylabel) == str:
                        a.set_ylabel(ylabel)
                    else:
                        a.set_ylabel(ylabel[row])
        if num_rows == 1:
            ax = [ax[i][0] for i in range(num_columns)]
        return fig, ax
def _create_axes ( self , num_rows = 1 , size = ( 8 , 5 ) , ylabel = None , ** kwargs ) : num_columns = 1 if self . _is_multi_scenario_func else self . num_scenarios fig = GraphTools . _create_figure ( size = ( size [ 0 ] * num_columns , size [ 1 ] ) , ** kwargs ) ax = fig . subplots ( nrows = num_rows , ncols = num_columns , sharey = 'row' , squeeze = False ) ax = [ [ ax [ j ] [ i ] for j in range ( num_rows ) ] for i in range ( num_columns ) ] for col , col_plots in enumerate ( ax ) : for row , a in enumerate ( col_plots ) : if num_columns > 1 and row == 0 : a . set_title ( f"Scenario: {self._scenarios[col].name}" ) if ylabel is not None : if type ( ylabel ) == str : a . set_ylabel ( ylabel ) else : a . set_ylabel ( ylabel [ row ] ) if num_rows == 1 : ax = [ ax [ i ] [ 0 ] for i in range ( num_columns ) ] return fig , ax
Create a set of matplotlib axes
Create a set of matplotlib axes
"""
        Create a set of matplotlib axes
        """ # Set a title to each subplot
self
num_rows
size
ylabel