-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Improve documentation of important ggproto classes #6426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
teunbrand
wants to merge
29
commits into
tidyverse:main
Choose a base branch
from
teunbrand:fancy_ggproto_docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Merge branch 'main' into fancy_ggproto_docs # Conflicts: # R/coord-.R # R/facet-.R # R/guide-.R # R/layer.R # man/ggplot2-ggproto.Rd
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to fix #6404 and fix #2646.
Briefly, it does two things:
?ggplot2-ggproto
doc page.Less briefly:
It is a bit of a beefy PR that documents bread and butter classes like:
Geom
,Stat
,Position
,Facet
,Coord
,Scale
andGuide
. I've documented them as I have come to understand them, please feel free to correct any misstated intent or purpose.This PR also touches two classes that may be unexpected:
Layer
andLayout
. These are sort of internal classes (Layout is exported, Layer is not), but they are very important to understanding the plot building process. I've dubbed these 'chaperone' classes because they sort of supervise other classes and ensure the proper introductions are made to other objects during plot building.Also it doesn't document four classes:
Guides
,ScalesList
,AxisSecondary
andViewScale
as they are not exported (so not intended for extension) and people don't need to reason about these very often.The
@field
roxygen tag is typically used for documenting R6 fields. As ggproto is a similar flavour of OOP system, I thought the parallels merit (ab)using this tag for documenting ggproto stuff. In contrast to R6, I've also documented methods with@field
as roxygen doesn't recognise ggproto classes in the same way it does R6 classes.I've tried to rearrange the methods in a class so that they roughly mirror chronological order in which they are used in the
ggplot_build()
/ggplot_gtable()
methods. This has worked well for most classes exceptScale
, where I tried to improvise a structure.I've also used the
# Foo -----------
headers to indicate document structure that gets converted to a nice outline in RStudio. Especially inscale-.R
this cleared up the outline enormously.