def modifiedaminoacids(df, kind='pie'):
    """
    Generate a plot of relative numbers of modified amino acids in source DataFrame.

    Plot a pie or bar chart showing the number and percentage of modified amino
    acids in the supplied data frame. The amino acids displayed will be
    determined from the supplied data/modification type.

    :param df: processed DataFrame
    :param kind: `str` type of plot; either "pie" or "bar"
    :return: matplotlib ax
    """

    colors =   ['#6baed6','#c6dbef','#bdbdbd']
    total_aas, quants = analysis.modifiedaminoacids(df)
    
    df = pd.DataFrame()
    for a, n in quants.items():
        df[a] = [n]

    df.sort_index(axis=1, inplace=True)
    
    if kind == 'bar' or kind == 'both':
        ax1 = df.plot(kind='bar', figsize=(7,7), color=colors)
        ax1.set_ylabel('Number of phosphorylated amino acids')
        ax1.set_xlabel('Amino acid')
        ax1.set_xticks([])
        ylim = np.max(df.values)+1000
        ax1.set_ylim(0, ylim )
        _bartoplabel(ax1, 100*df.values[0], total_aas, ylim )

        ax1.set_xlim((-0.3, 0.3))
        return ax
    
    if kind == 'pie' or kind == 'both':

        dfp =df.T
        residues = dfp.index.values
        
        dfp.index = ["%.2f%% (%d)" % (100*df[i].values[0]/total_aas, df[i].values[0]) for i in dfp.index.values ]
        ax2 = dfp.plot(kind='pie', y=0, colors=colors)
        ax2.legend(residues, loc='upper left', bbox_to_anchor=(1.0, 1.0))
        ax2.set_ylabel('')
        ax2.set_xlabel('')
        ax2.figure.set_size_inches(6,6)

        for t in ax2.texts:
            t.set_fontsize(15)

        return ax2

    return ax1, ax2
Generate a plot of relative numbers of modified amino acids in source DataFrame.

    Plot a pie or bar chart showing the number and percentage of modified amino
    acids in the supplied data frame. The amino acids displayed will be
    determined from the supplied data/modification type.

    :param df: processed DataFrame
    :param kind: `str` type of plot; either "pie" or "bar"
    :return: matplotlib ax