% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lexical_analysis.R
\name{plot_ngram_frequency}
\alias{plot_ngram_frequency}
\title{Plot N-gram Frequency}
\usage{
plot_ngram_frequency(
  ngram_data,
  top_n = 30,
  selected = NULL,
  title = "N-gram Frequency",
  highlight_color = "#10B981",
  default_color = "#6B7280",
  height = 500,
  width = NULL,
  show_stats = TRUE
)
}
\arguments{
\item{ngram_data}{Data frame containing n-gram data with columns:
\itemize{
\item \code{collocation}: The n-gram text
\item \code{count}: Frequency count
\item \code{lambda}: (optional) Lambda statistic
\item \code{z}: (optional) Z-score statistic
}}

\item{top_n}{Number of top n-grams to display (default: 30)}

\item{selected}{Character vector of selected n-grams to highlight (default: NULL)}

\item{title}{Plot title (default: "N-gram Frequency")}

\item{highlight_color}{Color for highlighted bars (default: "#10B981")}

\item{default_color}{Color for non-highlighted bars (default: "#6B7280")}

\item{height}{Plot height in pixels (default: 500)}

\item{width}{Plot width in pixels (default: NULL for auto)}

\item{show_stats}{Whether to show lambda and z-score in hover (default: TRUE)}
}
\value{
A plotly object
}
\description{
Creates a bar plot showing n-gram frequencies with optional highlighting
of selected n-grams. Supports both detected n-grams and selected multi-word expressions.
}
\examples{
\donttest{
  ngram_df <- data.frame(
    collocation = c("machine learning", "deep learning", "neural network"),
    count = c(150, 120, 90),
    lambda = c(5.2, 4.8, 4.1),
    z = c(12.3, 10.5, 9.2)
  )
  plot_ngram_frequency(ngram_df, selected = c("machine learning"))
}
}
\concept{visualization}
