def plot_number_of_structures_per_kinase(structures, top_n_kinases=30):
    """
    Plot the number of structures per kinase (for the top N kinases with the most structures).

    Parameters
    ----------
    structures : pandas.DataFrame
        Structures DataFrame from opencadd.databases.klifs module.
    top_n_kinases : int
        Plot only the top N kinases with the most structures.

    Returns
    -------
    matplotlib.pyplot.axis
        Plot axis.
    """
    plot_height = top_n_kinases / 5
    n_structures_per_kinase = structures.groupby("kinase.klifs_name").size()
    ax = (
        n_structures_per_kinase.sort_values(ascending=False)
        .head(top_n_kinases)
        .sort_values()
        .plot(
            kind="barh",
            figsize=(4, plot_height),
            title=f"Number of structures per kinase (top {top_n_kinases} kinases)",
            xlabel="KLIFS kinase name",
        )
    )
    return ax