% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make_wordcloud.R
\name{make_wordcloud}
\alias{make_wordcloud}
\title{Create a Word Cloud from Term Frequencies}
\usage{
make_wordcloud(
  x,
  max_terms = 200,
  size = 1,
  shape = "circle",
  ellipticity = 0.65,
  ...,
  width = 910,
  output = NULL,
  display = FALSE
)
}
\arguments{
\item{x}{'data.frame'.
Term-frequency table containing at least the columns \code{term} and \code{freq}.}

\item{max_terms}{'integer' number.
Maximum number of terms to include, taken in order of decreasing frequency.
Defaults to 200.}

\item{size}{'numeric' number.
Font-size scaling factor. Defaults to 1.}

\item{shape}{'character' string.
Shape of the cloud. One of \code{"circle"} (the default), \code{"cardioid"}, \code{"diamond"},
\code{"triangle-forward"}, \code{"triangle"}, \code{"pentagon"}, or \code{"star"}.}

\item{ellipticity}{'numeric' number between 0 and 1.
Degree of flattening applied to the shape. Defaults to 0.65.}

\item{...}{Additional arguments passed to \code{\link[wordcloud2:wordcloud2]{wordcloud2::wordcloud2()}}.}

\item{width}{'integer' number.
Image width in pixels. Defaults to 910. Image height is derived from \code{width}
and \code{ellipticity}.}

\item{output}{'character' string.
Path to the output PNG file. Defaults to a temporary file.}

\item{display}{'logical' flag.
Whether to display the saved PNG in a graphics window. Requires the \pkg{magick}
package. Defaults to \code{FALSE}.}
}
\value{
Invisibly returns the file path to the word-cloud PNG.
}
\description{
Create a word cloud from a term-frequency table and save it as a PNG
file. The most frequent terms are rendered, laid out within the chosen shape.
Requires the \pkg{htmltools}, \pkg{htmlwidgets}, \pkg{magick}, \pkg{webshot2},
and \pkg{wordcloud2} packages. System dependencies are
\href{https://imagemagick.org/}{ImageMagick} (for displaying the PNG),
\href{https://optipng.sourceforge.net/}{OptiPNG} (for PNG compression), and a
\href{https://www.google.com/chrome/}{Chrome} or Chromium-based browser with
support for the Chrome DevTools protocol. Use
\code{\link[chromote:find_chrome]{chromote::find_chrome()}} to locate the browser.
}
\examples{
\dontrun{
  d <- wordcloud2::demoFreq |> head(n = 10)
  colnames(d) <- c("term", "freq")
  file <- make_wordcloud(d, display = interactive())

  unlink(file)
}
}
\seealso{
\code{\link{mine_text}} to build a term-frequency table.
}
\author{
J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center
}
