def seqlogo_fig(letter_heights, vocab="DNA", figsize=(10, 2), ncol=1, plot_name=None):
    """

    # Arguments
        plot_name: Title of the plot. Can be a list of names
    """
    fig = plt.figure(figsize=figsize)

    if len(letter_heights.shape) == 3:
        #
        n_plots = letter_heights.shape[2]
        nrow = math.ceil(n_plots / ncol)
        if isinstance(plot_name, list):
            assert len(plot_name) == n_plots
    else:
        n_plots = 1
        nrow = 1
        ncol = 1

    for i in range(n_plots):
        if len(letter_heights.shape) == 3:
            w_cur = letter_heights[:, :, i]
        else:
            w_cur = letter_heights
        ax = plt.subplot(nrow, ncol, i + 1)
        plt.tight_layout()

        # plot the motif
        seqlogo(w_cur, vocab, ax)

        # add the title
        if plot_name is not None:
            if n_plots > 0:
                if isinstance(plot_name, list):
                    pln = plot_name[i]
                else:
                    pln = plot_name + " {0}".format(i)
            else:
                pln = plot_name
            ax.set_title(pln)
    return fig
def seqlogo_fig ( letter_heights , vocab = "DNA" , figsize = ( 10 , 2 ) , ncol = 1 , plot_name = None ) : fig = plt . figure ( figsize = figsize ) if len ( letter_heights . shape ) == 3 : n_plots = letter_heights . shape [ 2 ] nrow = math . ceil ( n_plots / ncol ) if isinstance ( plot_name , list ) : assert len ( plot_name ) == n_plots else : n_plots = 1 nrow = 1 ncol = 1 for i in range ( n_plots ) : if len ( letter_heights . shape ) == 3 : w_cur = letter_heights [ : , : , i ] else : w_cur = letter_heights ax = plt . subplot ( nrow , ncol , i + 1 ) plt . tight_layout ( ) seqlogo ( w_cur , vocab , ax ) if plot_name is not None : if n_plots > 0 : if isinstance ( plot_name , list ) : pln = plot_name [ i ] else : pln = plot_name + " {0}" . format ( i ) else : pln = plot_name ax . set_title ( pln ) return fig
# Arguments
        plot_name: Title of the plot. Can be a list of names