The ggplot2 argument is linewidth -- should we instead go in the other direction to be consistent with the core plotting framework?#453
Conversation
…r direction to be consistent with the core plotting framework? Fixes #452
There was a problem hiding this comment.
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.
| # handle alias | ||
| dots <- list(...) | ||
| if (!is.null(dots[["linewidth"]])) { | ||
| size_line <- dots[["linewidth"]] | ||
| } |
There was a problem hiding this comment.
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)
}
Fixes #452