def __init__(
        self,
        size,
        energies,
        state_names=None,
        number_of_interactions=4,
        virtual=[None],
        state_font_size=8,
        state_text_buffer=0.5,
    ):
        """Initialize.

        Parameters
        ----------
        size : [rows, collumns]
            Layout.
        energies : list of numbers
            State energies.
        state_names : list of strings (optional)
            State names. Default is None.
        number_of_interactions : integer (optional)
            Number of interactions. Default is 4.
        virtual : list of integers (optional)
            Indices of states which are virtual. Default is [None].
        state_font_size : number (optional)
            State font size. Default is 8.
        state_text_buffer : number (optional)
            Size of buffer around state text. Default is 0.5.
        """
        # create figure
        figsize = [int(size[0] * ((number_of_interactions + 1.) / 6.)), size[1] * 2.5]
        fig, (subplots) = plt.subplots(size[1], size[0], figsize=figsize)
        self.fig = fig
        # wrap subplots if need be
        if size == [1, 1]:
            self.subplots = np.array([[subplots]])
            plt.subplots_adjust(left=0.3)
        elif size[1] == 1:
            self.subplots = np.array([subplots])
        else:
            self.subplots = subplots
        # add energy levels
        self.energies = energies
        for plot in self.subplots.flatten():
            for i in range(len(self.energies)):
                if i in virtual:
                    linestyle = "--"
                else:
                    linestyle = "-"
                plot.axhline(energies[i], color="k", linewidth=2, linestyle=linestyle)
        # add state names to leftmost plots
        if state_names:
            for i in range(size[1]):
                plot = self.subplots[i][0]
                for j in range(len(self.energies)):
                    plot.text(
                        -state_text_buffer,
                        energies[j],
                        state_names[j],
                        fontsize=state_font_size,
                        verticalalignment="center",
                        horizontalalignment="center",
                    )
        # calculate interaction_positons
        self.x_pos = np.linspace(0, 1, number_of_interactions)
        # plot cleans up a bunch - call it now as well as later
        self.plot()
def __init__ ( self , size , energies , state_names = None , number_of_interactions = 4 , virtual = [ None ] , state_font_size = 8 , state_text_buffer = 0.5 , ) : figsize = [ int ( size [ 0 ] * ( ( number_of_interactions + 1. ) / 6. ) ) , size [ 1 ] * 2.5 ] fig , ( subplots ) = plt . subplots ( size [ 1 ] , size [ 0 ] , figsize = figsize ) self . fig = fig if size == [ 1 , 1 ] : self . subplots = np . array ( [ [ subplots ] ] ) plt . subplots_adjust ( left = 0.3 ) elif size [ 1 ] == 1 : self . subplots = np . array ( [ subplots ] ) else : self . subplots = subplots self . energies = energies for plot in self . subplots . flatten ( ) : for i in range ( len ( self . energies ) ) : if i in virtual : linestyle = "--" else : linestyle = "-" plot . axhline ( energies [ i ] , color = "k" , linewidth = 2 , linestyle = linestyle ) if state_names : for i in range ( size [ 1 ] ) : plot = self . subplots [ i ] [ 0 ] for j in range ( len ( self . energies ) ) : plot . text ( - state_text_buffer , energies [ j ] , state_names [ j ] , fontsize = state_font_size , verticalalignment = "center" , horizontalalignment = "center" , ) self . x_pos = np . linspace ( 0 , 1 , number_of_interactions ) self . plot ( )
Initialize.

        Parameters
        ----------
        size : [rows, collumns]
            Layout.
        energies : list of numbers
            State energies.
        state_names : list of strings (optional)
            State names. Default is None.
        number_of_interactions : integer (optional)
            Number of interactions. Default is 4.
        virtual : list of integers (optional)
            Indices of states which are virtual. Default is [None].
        state_font_size : number (optional)
            State font size. Default is 8.
        state_text_buffer : number (optional)
            Size of buffer around state text. Default is 0.5.