Skip to content

Consolidate per-wrapper roxygen docs onto parent help pages#37

Merged
yihui merged 4 commits intomainfrom
copilot/consolidate-roxygen-docs
Apr 8, 2026
Merged

Consolidate per-wrapper roxygen docs onto parent help pages#37
yihui merged 4 commits intomainfrom
copilot/consolidate-roxygen-docs

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

  • Initial consolidation: replace @inheritParams with @Rdname in all wrapper functions
  • Fix \description{} pollution: move wrapper body paragraphs to @details \fn()`: ...`
  • Remove titles from all @Rdname wrapper roxygen blocks
  • Fix scrollbar_ parent: add missing description paragraph
  • Remove redundant examples (axis_x/axis_y title-setting; coord_polar/radial covered by parent)
  • Reuse g2 objects with p = g2(...) pattern across all pages
  • Add @details to all wrapper functions
  • Extract inline data.frame to named df variable in all examples
  • Move coord_theta(innerRadius=0.5) example to parent block (before radar context); remove from wrapper
  • Fix coord_transpose: extract inline data.frame
  • Verb consistency in mark_.Rd @details: remove trailing s ("Draw" not "Draws", "Place" not "Places", etc.)
  • Add blank line + comment before each new example section across all merged pages (mark_, scale_, coord_, theme_, legend_, slider_, scrollbar_)
  • Regenerated man pages, tests pass, R CMD check clean

Copy link
Copy Markdown
Owner

@yihui yihui left a comment

Choose a reason for hiding this comment

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

after merging docs, check for redundant examples, e.g., in axis_.Rd, you've already shown examples of axis_x and axis_y in the first example, and you can discard the newly merged ones:

g2(mtcars, hp ~ mpg) |>
  axis_x(title = 'Miles per Gallon')
g2(mtcars, hp ~ mpg) |>
  axis_y(title = 'Horsepower')

reuse g2 objects when possible, e.g., write

g2(iris, Sepal.Length ~ Sepal.Width, color = ~ Species) |>
  legend_('color', position = 'right')
g2(iris, Sepal.Length ~ Sepal.Width, color = ~ Species) |>
  legend_color(position = 'right')

as

p = g2(iris, Sepal.Length ~ Sepal.Width, color = ~ Species)
p |> legend_('color', position = 'right')
p |> legend_color(position = 'right')

you can feel free to keep using the name p on the same help page, even if a later p is a new one overriding the previous one

try to stay with one dataset on one help page if possible, unless a new dataset is needed to demo a special feature that can't be done with the current dataset

you must also describe each individual function when there are multiple of them on one page; the description should start with the function name, and be added to @details instead of @description of that page; currently you may take a look at mark_.Rd and you'll find that the description is not clear---we have no idea which function does what

Copilot AI and others added 2 commits April 8, 2026 21:09
…e p, remove redundant examples

Agent-Logs-Url: https://github.com/yihui/gglite/sessions/d86a7be8-63f4-4dcf-8308-47faf15945bc

Co-authored-by: yihui <163582+yihui@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 8, 2026

after merging docs, check for redundant examples, e.g., in axis_.Rd, you've already shown examples of axis_x and axis_y in the first example, and you can discard the newly merged ones:

Done in a8ab326 / 43375c8:

  • Redundant examples removed: axis_x()/axis_y() title-setting examples dropped (already shown by parent); coord_polar()/coord_radial() wrapper examples dropped (parent covers them); coord_theta() keeps innerRadius = 0.5 since that's a new option.
  • Object reuse: p = g2(...) defined in parent examples and reused by wrappers across theme_, coord_, scale_, legend_, slider_, scrollbar_, and mark_ (line/area, line_x/line_y/range/range_x/range_y, boxplot/beeswarm, sankey/chord, treemap/pack groups).
  • One dataset per page: Consolidated where possible; mark_ still uses both mtcars and iris since different marks require different data shapes.
  • Per-function @details: Every wrapper now has #' @details \fn()`: ...(no title, tag on same line as content,()after the name). The\description{}` section on every help page is now clean — only the parent's description appears there.
  • scrollbar_ fix: Added a description paragraph to the parent so wrapper titles no longer bleed into \description{}.

Copilot AI requested a review from yihui April 8, 2026 21:11
Copilot finished work on behalf of yihui April 8, 2026 21:11
Comment thread man/coord_.Rd Outdated
scale_x(padding = 0.5, align = 0) |>
scale_y(domainMin = 0, domainMax = 100) |>
axis_x(grid = TRUE)
p |> transform_('stackY') |> coord_theta(innerRadius = 0.5)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This example obviously doesn't belong here but should be moved to an earlier place: the context has switched to df2 and radar coord, but this p was created earlier than that

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in f0dc33d. The coord_theta(innerRadius = 0.5) example is now in the parent block immediately after the basic coord_theta() call, well before df2/radar are introduced. Removed @examples from the wrapper.

Comment thread man/mark_.Rd
Comment on lines +138 to +150
\code{mark_interval()}: Add an interval mark for bar and column charts.

\code{mark_line()}: Add a line mark (connects points sorted by x).

\code{mark_point()}: Add a point mark (scatter plot).

\code{mark_area()}: Add an area mark (filled region under the line).

\code{mark_rect()}: Draws rectangles. Commonly used with a \code{bin}
transform for 2-D histograms.

\code{mark_cell()}: Draws rectangular cells, commonly used for heatmaps
and calendar charts.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

the starting verbs are inconsistent: use either singular or plural, but not both on the same page, e.g., add and draw, or adds and draws; i'd suggest getting rid of s for all

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in f0dc33d. All verbs now use the imperative form throughout mark_.Rd @details: "Draw", "Place", "Connect", "Shade", "Display", "Visualize" — zero occurrences of the -s forms remain.

Comment thread man/mark_.Rd
Comment on lines +258 to +260
df = data.frame(x = 1:5, y = c(3, 1, 4, 1, 5))
p = g2(df, y ~ x)
p |> mark_line()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

add comments explain what the chart is, and make sure to leave a blank line before the comment to make the sections clearer

apply this change to all examples merged to the same page

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in f0dc33d. Every new example section across all merged pages (mark_, scale_, coord_, theme_, legend_, slider_, scrollbar_) now starts with a blank line followed by a # Comment describing the chart. Examples that share the same base p are grouped under a single comment.

Comment thread man/mark_.Rd Outdated
Comment on lines +248 to +249
g2(data.frame(x = c('A', 'B', 'C'), y = c(3, 7, 2)), y ~ x) |>
mark_interval()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

for data passed to g2(), define it outside the call to make the g2() call cleaner;

apply this to all examples

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in f0dc33d. All g2(data.frame(...), ...) inline constructions across mark.R, coordinate.R, and scale.R now define df = data.frame(...) on a separate line before the g2() call.

…ctions, inline data.frame extraction

Agent-Logs-Url: https://github.com/yihui/gglite/sessions/15936d3c-2223-4bae-8df8-428014ce0413

Co-authored-by: yihui <163582+yihui@users.noreply.github.com>
@yihui yihui marked this pull request as ready for review April 8, 2026 21:52
@yihui yihui merged commit 9380c14 into main Apr 8, 2026
8 checks passed
@yihui yihui deleted the copilot/consolidate-roxygen-docs branch April 8, 2026 21:53
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.

2 participants