Skip to content

The ggplot2 argument is linewidth -- should we instead go in the other direction to be consistent with the core plotting framework?#453

Open
strengejacke wants to merge 2 commits into
mainfrom
linewidth_alias
Open

The ggplot2 argument is linewidth -- should we instead go in the other direction to be consistent with the core plotting framework?#453
strengejacke wants to merge 2 commits into
mainfrom
linewidth_alias

Conversation

@strengejacke

Copy link
Copy Markdown
Member

Fixes #452

…r direction to be consistent with the core plotting framework?

Fixes #452

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the linewidth argument as an alias for size_line across various plotting functions, updating the corresponding implementation, documentation, and tests. The reviewer points out an issue in plot.see_p_function where passing a single value via the alias can trigger a sanity check error when multiple groups are present, and suggests replicating the value to a length of 2 to improve robustness.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread R/plot.p_function.R
Comment on lines +47 to +51
# handle alias
dots <- list(...)
if (!is.null(dots[["linewidth"]])) {
size_line <- dots[["linewidth"]]
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

In plot.see_p_function, size_line is expected to be a vector of length 2 when there are multiple groups (to specify sizes for both regular and emphasized interval lines). If a user passes a single value via the linewidth alias (or size_line), it will trigger a sanity check error on line 75. Replicating size_line to length 2 when a single value is provided prevents this error and improves usability.

  # handle alias
  dots <- list(...)
  if (!is.null(dots[["linewidth"]])) {
    size_line <- dots[["linewidth"]]
  }
  if (length(size_line) == 1) {
    size_line <- rep(size_line, length.out = 2)
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The ggplot2 argument is linewidth -- should we instead go in the other direction to be consistent with the core plotting framework?

1 participant