Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions r/R/draw_spectrogram.R
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@
#' @param colorbar_title Optional Character: Colorbar label. Default: `"dB"`,
#' `"Power"`, or `"Amplitude"` derived from `db` and `power`.
#' @param title Optional Character: Chart title.
#' @param x_lab Optional Character: X-axis label. Default: `"Time (s)"` or
#' @param xlab Optional Character: X-axis label. Default: `"Time (s)"` or
#' `"Time (ms)"` depending on `time_unit`.
#' @param y_lab Optional Character: Y-axis label. Default: `"Frequency (Hz)"`
#' @param ylab Optional Character: Y-axis label. Default: `"Frequency (Hz)"`
#' or `"Frequency (kHz)"` depending on `freq_unit`.
#' @param theme Optional [Theme], list, or `NA`: Theme override passed to
#' [draw()].
Expand Down Expand Up @@ -243,8 +243,8 @@ draw_spectrogram <- function(
show_colorbar = TRUE,
colorbar_title = NULL,
title = NULL,
x_lab = NULL,
y_lab = NULL,
xlab = NULL,
ylab = NULL,
Comment on lines 243 to +247

Copilot AI Apr 28, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming x_lab/y_lab to xlab/ylab is a breaking API change: existing user code calling draw_spectrogram(..., x_lab = ...) will now error with an unused argument. Consider keeping x_lab/y_lab as deprecated aliases (and mapping them to xlab/ylab, with a warning if both are provided) for at least one release cycle.

Copilot uses AI. Check for mistakes.
theme = NULL,
margins = DEFAULT_MARGINS,
width = NULL,
Expand Down Expand Up @@ -574,8 +574,8 @@ draw_spectrogram <- function(
freq_digits <- if (freq_unit == "kHz") 3L else 1L
val_digits <- if (db) 1L else 3L

x_lab <- x_lab %||% paste0("Time (", time_unit, ")")
y_lab <- y_lab %||% paste0("Frequency (", freq_unit, ")")
xlab <- xlab %||% paste0("Time (", time_unit, ")")
ylab <- ylab %||% paste0("Frequency (", freq_unit, ")")
colorbar_title <- colorbar_title %||%
if (db) {
"dB"
Expand Down Expand Up @@ -640,15 +640,17 @@ draw_spectrogram <- function(
x_axis = Axis(
type = "category",
data = as.list(time_fmt),
name = x_lab,
name = xlab,
name_location = if (!is.null(xlab)) "middle" else NULL,
boundary_gap = TRUE,
Comment thread
egenn marked this conversation as resolved.
split_area = SplitArea(show = FALSE),
axis_line = AxisLine(show = FALSE)
),
y_axis = Axis(
type = "category",
data = as.list(freq_fmt),
name = y_lab,
name = ylab,
name_location = if (!is.null(ylab)) "middle" else NULL,
Comment thread
egenn marked this conversation as resolved.
boundary_gap = TRUE,
split_area = SplitArea(show = FALSE),
axis_line = AxisLine(show = FALSE)
Expand Down
8 changes: 4 additions & 4 deletions r/man/draw_spectrogram.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading