Skip to content

Commit 06e91ca

Browse files
Copilotyihui
andauthored
add @nord to unexported parent functions to clean up man pages
Agent-Logs-Url: https://github.com/yihui/gglite/sessions/e8895fa3-fcde-4bf6-a1f0-06063892ac04 Co-authored-by: yihui <163582+yihui@users.noreply.github.com>
1 parent 2631950 commit 06e91ca

File tree

11 files changed

+6
-271
lines changed

11 files changed

+6
-271
lines changed

R/component.R

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,7 @@
1111
#' @param ... Axis options such as `title`, `labelFormatter`, `tickCount`,
1212
#' `grid`, `position`, etc., or `FALSE` to hide.
1313
#' @return The modified `g2` object.
14-
#' @examples
15-
#' # Chart-level axis titles (no marks yet)
16-
#' g2(mtcars, hp ~ mpg) |>
17-
#' axis_x(title = 'Miles per Gallon') |>
18-
#' axis_y(title = 'Horsepower')
19-
#'
20-
#' # Dual-axis chart: each mark gets its own axis immediately after mark_*()
21-
#' air = aggregate(cbind(Temp, Wind) ~ Month, data = airquality, FUN = mean)
22-
#' air$Month = month.abb[air$Month]
23-
#' g2(air, x = 'Month') |>
24-
#' mark_interval(encode = list(y = 'Temp')) |>
25-
#' scale_y(independent = TRUE) |>
26-
#' axis_y(title = 'Temperature (°F)') |>
27-
#' mark_line(encode = list(y = 'Wind')) |>
28-
#' scale_y(independent = TRUE) |>
29-
#' axis_y(position = 'right', grid = FALSE, title = 'Wind Speed (mph)')
14+
#' @noRd
3015
axis_ = function(chart = NULL, channel, ...) {
3116
mod = check_chart(axis_, chart, c(if (!missing(channel)) list(channel), list(...)))
3217
if (!is.null(mod)) return(mod)
@@ -87,9 +72,7 @@ axis_y = function(chart = NULL, ...) axis_(chart, 'y', ...)
8772
#' @param ... Legend options such as `position` (`'top'`, `'bottom'`, `'left'`,
8873
#' `'right'`), `layout`, `title`, etc.
8974
#' @return The modified `g2` object.
90-
#' @examples
91-
#' p = g2(iris, Sepal.Length ~ Sepal.Width, color = ~ Species)
92-
#' p |> legend_color(position = 'right')
75+
#' @noRd
9376
legend_ = function(chart = NULL, channel, ...) {
9477
mod = check_chart(legend_, chart, c(if (!missing(channel)) list(channel), list(...)))
9578
if (!is.null(mod)) return(mod)
@@ -275,9 +258,7 @@ style_mark = function(chart = NULL, ...) {
275258
#' @param channel Positional channel: `'x'` or `'y'`.
276259
#' @param ... Slider options.
277260
#' @return The modified `g2` object.
278-
#' @examples
279-
#' p = g2(mtcars, hp ~ mpg)
280-
#' p |> slider_x()
261+
#' @noRd
281262
slider_ = function(chart = NULL, channel, ...) {
282263
mod = check_chart(slider_, chart, c(if (!missing(channel)) list(channel), list(...)))
283264
if (!is.null(mod)) return(mod)
@@ -312,10 +293,7 @@ slider_y = function(chart = NULL, ...) slider_(chart, 'y', ...)
312293
#' @param channel Positional channel: `'x'` or `'y'`.
313294
#' @param ... Scrollbar options.
314295
#' @return The modified `g2` object.
315-
#' @examples
316-
#' df = data.frame(x = 1:100, y = cumsum(rnorm(100)))
317-
#' p = g2(df, y ~ x) |> mark_line()
318-
#' p |> scroll_x()
296+
#' @noRd
319297
scroll_ = function(chart = NULL, channel, ...) {
320298
mod = check_chart(scroll_, chart, c(if (!missing(channel)) list(channel), list(...)))
321299
if (!is.null(mod)) return(mod)

R/mark.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
#' When `data` is a data frame, only columns referenced by the chart or
1111
#' mark-level encodings are kept. Wrap it in [I()] to preserve all columns.
1212
#' @return The modified `g2` object.
13-
#' @examples
14-
#' g2(mtcars, hp ~ mpg) |> mark_point()
1513
mark_ = function(chart = NULL, type, ...) {
1614
mod = check_chart(mark_, chart, c(if (!missing(type)) list(type), list(...)))
1715
if (!is.null(mod)) return(mod)

R/scale.R

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,7 @@
1717
#' @param ... Scale options passed to G2 (e.g., `type = 'log'`, `nice = TRUE`,
1818
#' `domain`, `range`, `zero = TRUE`).
1919
#' @return The modified `g2` object.
20-
#' @examples
21-
#' p = g2(mtcars, hp ~ mpg)
22-
#' # Log-scaled x axis
23-
#' p |> scale_x(type = 'log')
24-
#'
25-
#' # Square-root scale on y
26-
#' p |> scale_y(type = 'sqrt')
27-
#'
28-
#' # Ordinal color palette
29-
#' g2(iris, Sepal.Length ~ Sepal.Width, color = ~ Species) |>
30-
#' scale_color(palette = 'category10')
31-
#'
32-
#' # Dual-axis: pipe scale_y() right after each mark
33-
#' air = aggregate(cbind(Temp, Wind) ~ Month, data = airquality, FUN = mean)
34-
#' air$Month = month.abb[air$Month]
35-
#' g2(air, x = 'Month') |>
36-
#' mark_interval(encode = list(y = 'Temp')) |>
37-
#' scale_y(independent = TRUE) |>
38-
#' mark_line(encode = list(y = 'Wind')) |>
39-
#' scale_y(independent = TRUE) |>
40-
#' axis_y(position = 'right', grid = FALSE)
20+
#' @noRd
4121
scale_ = function(chart = NULL, field, ...) {
4222
mod = check_chart(scale_, chart, c(if (!missing(field)) list(field), list(...)))
4323
if (!is.null(mod)) return(mod)

R/theme.R

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222
#' @param type Theme name string, or a list of custom theme options.
2323
#' @param ... Additional theme options merged with the type.
2424
#' @return The modified `g2` object.
25-
#' @examples
26-
#' p = g2(mtcars, hp ~ mpg)
27-
#' p |> theme_dark()
28-
#' p |> theme_academy()
25+
#' @noRd
2926
theme_ = function(chart = NULL, type, ...) {
3027
mod = check_chart(theme_, chart, c(if (!missing(type)) list(type), list(...)))
3128
if (!is.null(mod)) return(mod)

man/axis_.Rd

Lines changed: 0 additions & 43 deletions
This file was deleted.

man/legend_.Rd

Lines changed: 0 additions & 27 deletions
This file was deleted.

man/mark_.Rd

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/scale_.Rd

Lines changed: 0 additions & 55 deletions
This file was deleted.

man/scroll_.Rd

Lines changed: 0 additions & 26 deletions
This file was deleted.

man/slider_.Rd

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)