Consolidate per-wrapper roxygen docs onto parent help pages#37
Conversation
Agent-Logs-Url: https://github.com/yihui/gglite/sessions/e3cb30ea-e203-4477-924e-8b18a2d22317 Co-authored-by: yihui <163582+yihui@users.noreply.github.com>
yihui
left a comment
There was a problem hiding this comment.
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
…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>
Agent-Logs-Url: https://github.com/yihui/gglite/sessions/d86a7be8-63f4-4dcf-8308-47faf15945bc Co-authored-by: yihui <163582+yihui@users.noreply.github.com>
|
| 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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
| \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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
| df = data.frame(x = 1:5, y = c(3, 1, 4, 1, 5)) | ||
| p = g2(df, y ~ x) | ||
| p |> mark_line() |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
| g2(data.frame(x = c('A', 'B', 'C'), y = c(3, 7, 2)), y ~ x) |> | ||
| mark_interval() |
There was a problem hiding this comment.
for data passed to g2(), define it outside the call to make the g2() call cleaner;
apply this to all examples
There was a problem hiding this comment.
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>
\description{}pollution: move wrapper body paragraphs to@details \fn()`: ...`p = g2(...)pattern across all pagess("Draw" not "Draws", "Place" not "Places", etc.)