Skip to content

Rename *_of() API to trailing-underscore convention with helper wrappers; move padding to g2()#10

Merged
yihui-bot merged 5 commits intomainfrom
copilot/improve-padding-arguments
Mar 31, 2026
Merged

Rename *_of() API to trailing-underscore convention with helper wrappers; move padding to g2()#10
yihui-bot merged 5 commits intomainfrom
copilot/improve-padding-arguments

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 31, 2026

  • Remove padding_of(), add padding/margin/inset args to g2() with scalar/vector support
  • Rename *_of() functions with helper wrappers
  • Update all example Rmd files, vignettes, README
  • R CMD check passes (Status: OK)
  • Browser-test rendered example plots
  • Replace @keywords internal with @noRd for internal functions (keep roxygen docs)
  • Rename coordinate()coord_() for consistency
  • Rename markmark_() and export it
  • Prefer helper functions in examples: theme_classic(), coord_polar(), etc.
  • Restore roxygen comments for @noRd internal functions (g2_cdn, process_layout, annotate_df, dropNulls, build_config)

Copilot AI and others added 3 commits March 31, 2026 16:56
Replace all old function names in examples/, vignettes/, and NEWS.md:
- scale_of() -> scale_x(), scale_y(), scale_color(), scale_size()
- axis_of() -> axis_x(), axis_y()
- legend_of() -> legend_color()
- slider_of() -> slider_x(), slider_y()
- scrollbar_of() -> scrollbar_x(), scrollbar_y()
- transform_of() -> transform_()
- theme_of() -> theme_()
- title_of() -> title_()
- tooltip_of() -> tooltip_()
- labels_of() -> labels_()
- padding_of() -> padding arg in g2()

Also regenerated NAMESPACE and man pages via roxygen2.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: yihui-bot <264330240+yihui-bot@users.noreply.github.com>
Co-authored-by: yihui-bot <264330240+yihui-bot@users.noreply.github.com>
… wrappers, merge main branch, update all docs/tests/examples

Agent-Logs-Url: https://github.com/yihui/gglite/sessions/74c49215-645d-42b9-8c58-c1408c38e3e0

Co-authored-by: yihui-bot <264330240+yihui-bot@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@yihui-bot yihui-bot left a comment

Choose a reason for hiding this comment

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

we should rename the function mark to mark_ and export it

if a function has verb_foo helpers, the main function should be verb_; check if there are inconsistencies in this aspect other than coordinate() (which i've already discovered and mentioned)

Comment thread examples/themes.Rmd Outdated
g2(mtcars, x = 'mpg', y = 'hp') |>
mark_point() |>
theme_of('classic')
theme_('classic')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

since we have helper functions now, please always prefer using helper functions over the original *_() functions, e.g. here you should use theme_classic()

apply this change to all other places

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.

Done in 7faa5fe. Updated examples/themes.Rmd to use theme_classic(), theme_classicDark(), theme_light(), theme_dark(), theme_academy() instead of theme_('...'). Also updated examples/coordinates.Rmd to use coord_polar(), coord_theta(), etc. instead of coordinate('...').

Comment thread R/gglite.R Outdated
#' @param name Base name: `'padding'`, `'margin'`, or `'inset'`.
#' @param value `NULL`, a scalar, or a length-4 numeric vector.
#' @return A named list of layout options.
#' @keywords internal
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@noRd for internal functions; i don't need their Rd files; with @noRd, there's no need to use @keywords internal any more

if there are other internal functions with roxygen docs, do the same thing

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.

Done in 7faa5fe. Replaced @keywords internal with @noRd for process_layout, g2_cdn, annotate_df, dropNulls, and build_config. Their .Rd files are now deleted.

Comment thread NAMESPACE Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

for consistency, i think coordinate should be renamed to coord_

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.

Done in 7faa5fe. Renamed coordinate()coord_() and exported it. All coord_*() helpers now call coord_(). Updated examples, tests, and copilot-instructions. R CMD check passes.

…refer helpers in docs

Agent-Logs-Url: https://github.com/yihui/gglite/sessions/66d0fe75-a9b6-48e8-94fd-1b793b63b454

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

Copilot AI commented Mar 31, 2026

we should rename the function mark to mark_ and export it

if a function has verb_foo helpers, the main function should be verb_; check if there are inconsistencies in this aspect other than `...

Done in 7faa5fe. Renamed markmark_() and exported it. All mark_*() helpers now call mark_(). Also renamed coordinate()coord_() for the same consistency. I checked all other functions with verb_foo helpers — they already follow the verb_ pattern (scale_, axis_, legend_, slider_, scrollbar_, theme_). R CMD check passes clean.

Copilot AI requested a review from yihui-bot March 31, 2026 17:46
Copy link
Copy Markdown
Collaborator

@yihui-bot yihui-bot left a comment

Choose a reason for hiding this comment

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

i didn't mean to delete the roxygen docs for @keywords internal objects: the roxygen comments should be kept; it is just that they shouldn't generate the .Rd files (hence we are using @noRd); please restore the roxygen comments

@yihui-bot yihui-bot marked this pull request as ready for review March 31, 2026 17:58
Agent-Logs-Url: https://github.com/yihui/gglite/sessions/e8cabf8c-646f-46e5-a92c-b06e9720fd48

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

Copilot AI commented Mar 31, 2026

i didn't mean to delete the roxygen docs for @keywords internal objects: the roxygen comments should be kept; it is just that they shouldn't generate the .Rd files (hence we are using @noRd); plea...

Restored in a91b0d2. The full roxygen comments (title, description, @param, @return) are back for g2_cdn, process_layout, annotate_df, dropNulls, and build_config — each now uses @noRd so no .Rd files are generated.

Copilot AI requested a review from yihui-bot March 31, 2026 18:02
@yihui-bot yihui-bot merged commit 528ff79 into main Mar 31, 2026
5 checks passed
@yihui-bot yihui-bot deleted the copilot/improve-padding-arguments branch March 31, 2026 18:07
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