Visualize the "structure" of the Poisson NMF loadings or multinomial topic model mixture proportions by projection onto a 2-d surface. Samples in the projection are colored according to the their loadings/proportions. By default, t-SNE is used to compute the 2-d embedding from the loadings or mixture proportions.
tsne_plot( fit, color = c("mixprop", "loading"), k, tsne, ggplot_call = tsne_plot_ggplot_call, plot_grid_call = function(plots) do.call(plot_grid, plots), ... ) tsne_plot_ggplot_call(dat, topic.label, font.size = 9)
fit | An object of class “poisson_nmf_fit” or “multinom_topic_model_fit”. |
---|---|
color | The data mapped to the color “aesthetic” in the
plot. When |
k | The topic, or topics, selected by number or name. One plot is created per selected topic. When not specified, all topics are plotted. |
tsne | A 2-d embedding of the samples (rows of X), or a subset
of the samples, such as an output from
|
ggplot_call | The function used to create the plot. Replace
|
plot_grid_call | When multiple topics are selected, this is
the function used to arrange the plots into a grid using
|
... | Additional arguments passed to
|
dat | A data frame passed as input to
|
topic.label | The name or number of the topic being plotted; it is only used to determine the plot title. |
font.size | Font size used in plot. |
A ggplot
object.
This is a lightweight interface primarily intended to
expedite creation of scatterplots for visualizing the loadings or
mixture proportions in 2-d; most of the “heavy lifting” is
done by ggplot2. The 2-d embedding itself is computed by invoking
function tsne_from_topics
(unless the “tsne”
input is provided). For more control over the plot's appearance,
the plot can be customized by modifying the ggplot_call
and
plot_grid_call
arguments.
An effective 2-d visualization may also necessitate some
fine-tunning of the t-SNE settings, such as the
“perplexity”, or the number of samples included in the
plot. The t-SNE settings can be controlled by the additional
arguments (...) passed to tsne_from_topics
; see
tsne_from_topics
for details. Alternatively, a 2-d
embedding may be pre-computed, and passed as argument tsne
to tsne_plot
.