% Generated by roxygen2: do not edit by hand % Please edit documentation in R/topic_prevalence_plots.R \name{plot_topic_prevalence} \alias{plot_topic_prevalence} \title{Plot average topic prevalence} \usage{ plot_topic_prevalence( stm_model, topic_labels, out_file = NULL, save = TRUE, width = 25, height = 20 ) } \arguments{ \item{stm_model}{STM model object with \code{theta} matrix.} \item{topic_labels}{Table with columns \code{topic} and \code{label}.} \item{out_file}{Optional output path used when \code{save = TRUE}.} \item{save}{Logical scalar, whether to save the figure.} \item{width, height}{Numeric scalar dimensions in inches for saved file.} } \value{ A list with \code{topic_prev} (data.table) and \code{plot} (ggplot object). } \description{ Compute average prevalence from \code{theta} and draw a horizontal bar chart. Optionally save the figure. } \details{ Plot average topic prevalence from an STM model } \examples{ stm_model <- list(theta = matrix(c(0.2, 0.8, 0.4, 0.6), nrow = 2, byrow = TRUE)) topic_labels <- data.frame(topic = 1:2, label = c("Labor", "Trade")) plot_topic_prevalence(stm_model, topic_labels, save = FALSE) }