def plot_doc_topic_heatmap(fig, ax, doc_topic_distrib, doc_labels, topic_labels=None,
                           which_documents=None, which_document_indices=None,
                           which_topics=None, which_topic_indices=None,
                           xaxislabel=None, yaxislabel=None,
                           **kwargs):
    """
    Plot a heatmap for a document-topic distribution `doc_topic_distrib` to a matplotlib Figure `fig` and Axes `ax`
    using `doc_labels` as document labels on the y-axis and topics from 1 to `n_topics=doc_topic_distrib.shape[1]` on
    the x-axis.
    Custom topic labels can be passed as `topic_labels`.
    A subset of documents can be specified either with a sequence `which_documents` containing a subset of document
    labels from `doc_labels` or `which_document_indices` containing a sequence of document indices.
    A subset of topics can be specified either with a sequence `which_topics` containing sequence of numbers between
    [1, n_topics] or `which_topic_indices` which is a number between [0, n_topics-1]
    Additional arguments can be passed via `kwargs` to `plot_heatmap`.

    Please note that it is almost always necessary to select a subset of your document-topic distribution with the
    `which_documents` or `which_topics` parameters, as otherwise the amount of data to be plotted will be too high
    to give a reasonable picture.
    """
    if which_documents is not None and which_document_indices is not None:
        raise ValueError('only `which_documents` or `which_document_indices` can be set, not both')

    if which_topics is not None and which_topic_indices is not None:
        raise ValueError('only `which_topics` or `which_topic_indices` can be set, not both')

    if which_documents is not None:
        which_document_indices = np.where(np.isin(doc_labels, which_documents))[0]

    if which_topics is not None:
        which_topic_indices = np.array(which_topics) - 1

    select_distrib_subset = False

    if topic_labels is None:
        topic_labels = np.array(range(1, doc_topic_distrib.shape[1]+1))
    elif not isinstance(topic_labels, np.ndarray):
        topic_labels = np.array(topic_labels)

    if which_document_indices is not None:
        select_distrib_subset = True
        doc_labels = np.array(doc_labels)[which_document_indices]

    if which_topic_indices is not None:
        select_distrib_subset = True
        topic_labels = topic_labels[which_topic_indices]

    if select_distrib_subset:
        doc_topic_distrib = mat2d_window_from_indices(doc_topic_distrib, which_document_indices, which_topic_indices)

    return plot_heatmap(fig, ax, doc_topic_distrib,
                        xaxislabel=xaxislabel or 'topic',
                        yaxislabel=yaxislabel or 'document',
                        xticklabels=topic_labels,
                        yticklabels=doc_labels,
                        **kwargs)
Plot a heatmap for a document-topic distribution `doc_topic_distrib` to a matplotlib Figure `fig` and Axes `ax`
    using `doc_labels` as document labels on the y-axis and topics from 1 to `n_topics=doc_topic_distrib.shape[1]` on
    the x-axis.
    Custom topic labels can be passed as `topic_labels`.
    A subset of documents can be specified either with a sequence `which_documents` containing a subset of document
    labels from `doc_labels` or `which_document_indices` containing a sequence of document indices.
    A subset of topics can be specified either with a sequence `which_topics` containing sequence of numbers between
    [1, n_topics] or `which_topic_indices` which is a number between [0, n_topics-1]
    Additional arguments can be passed via `kwargs` to `plot_heatmap`.

    Please note that it is almost always necessary to select a subset of your document-topic distribution with the
    `which_documents` or `which_topics` parameters, as otherwise the amount of data to be plotted will be too high
    to give a reasonable picture.