Add two package vignettes, coord_*() and theme_*() wrappers#7
Add two package vignettes, coord_*() and theme_*() wrappers#7
Conversation
Agent-Logs-Url: https://github.com/yihui/gglite/sessions/92c20ecc-c37e-42fc-89d7-355c87807724 Co-authored-by: yihui-bot <264330240+yihui-bot@users.noreply.github.com>
| ```{r, include = FALSE} | ||
| library(gglite) | ||
| ``` |
There was a problem hiding this comment.
don't hide this chunk but move it down to the code chunk where gglite is used for the first time, otherwise it can be confusing that you used gglite functions without loading the package
There was a problem hiding this comment.
Moved library(gglite) from the hidden chunk to the first code chunk where gglite is used (the "Data and encodings" section). Commit 0183556.
| | `geom_point()` | `mark_point()` | "geom" → "mark" | | ||
| | `scale_x_log10()` | `scale_of('x', type = 'log')` | One function for all scales | | ||
| | `coord_flip()` | `coord_transpose()` | | | ||
| | `coord_polar()` | `coordinate('polar')` | | |
There was a problem hiding this comment.
we should provide wrapper functions coord_*() in gglite, too; coordinate('polar') is not easy to type and can't autocomplete
There was a problem hiding this comment.
Added coord_polar(), coord_theta(), coord_radial(), coord_radar(), coord_helix(), and coord_parallel() as wrappers around coordinate(). Updated both vignettes and the comparison table to use them. Commit 0183556.
| | `coord_flip()` | `coord_transpose()` | | | ||
| | `coord_polar()` | `coordinate('polar')` | | | ||
| | `facet_wrap()` / `facet_grid()` | `facet_rect()` / `facet_circle()` | | | ||
| | `theme_minimal()` | `theme_of('light')` | | |
There was a problem hiding this comment.
we should provide wrapper functions theme_*() in gglite
There was a problem hiding this comment.
Added theme_classic(), theme_classicDark(), theme_light(), theme_dark(), and theme_academy() as wrappers around theme_of(). Updated both vignettes and the comparison table to use them. Commit 0183556.
|
|
||
| ## Building blocks: geom → mark | ||
|
|
||
| Every ggplot2 `geom_*()` has a corresponding `mark_*()` in gglite. Here are the |
There was a problem hiding this comment.
is that claim true? you should do more thorough research (at least listing all ggplot2's geom_*) to confirm
if eventually you are not 100% sure, please revise the wording
There was a problem hiding this comment.
Revised the wording from "Every ggplot2 geom_*() has a corresponding mark_*()" to "Many ggplot2 geom_*() functions have corresponding mark_*() equivalents" and changed "Here are the most common mappings" to "Here are some common mappings". Also added a note about marks that don't have ggplot2 equivalents (sankey, chord, word_cloud, etc.). Commit 0183556.
| Graphics with support for 35+ geometry types (marks), scales, coordinates, | ||
| themes, transforms, facets, animations, and chart components (axes, legends, | ||
| titles, tooltips, labels, sliders, and scrollbars). Renders in R Markdown, | ||
| litedown, Shiny, and standalone HTML previews. |
There was a problem hiding this comment.
don't touch news for v0.1
There was a problem hiding this comment.
Reverted NEWS.md to its original state. Commit 0183556.
| ::: {.col2} | ||
|
|
||
| **ggplot2** | ||
| ```r | ||
| ggplot(iris, aes(Sepal.Width, Sepal.Length, | ||
| color = Species)) + | ||
| geom_point() | ||
| ``` | ||
|
|
||
| **gglite** | ||
| ```{r} | ||
| g2(iris, x = 'Sepal.Width', y = 'Sepal.Length', | ||
| color = 'Species') |> | ||
| mark_point() | ||
| ``` | ||
|
|
||
| ::: |
There was a problem hiding this comment.
use the div class flex-col; move package names into code blocks; don't run gglite code blocks r instead of {r}
| ::: {.col2} | |
| **ggplot2** | |
| ```r | |
| ggplot(iris, aes(Sepal.Width, Sepal.Length, | |
| color = Species)) + | |
| geom_point() | |
| ``` | |
| **gglite** | |
| ```{r} | |
| g2(iris, x = 'Sepal.Width', y = 'Sepal.Length', | |
| color = 'Species') |> | |
| mark_point() | |
| ``` | |
| ::: | |
| ::: flex-col | |
| ```r | |
| # ggplot2 | |
| ggplot(iris, aes(Sepal.Width, Sepal.Length, | |
| color = Species)) + | |
| geom_point() | |
| ``` | |
| ```r | |
| # gglite | |
| g2(iris, x = 'Sepal.Width', y = 'Sepal.Length', | |
| color = 'Species') |> | |
| mark_point() | |
| ``` | |
| ::: |
apply the same change to all following sections when we make side-by-side comparisons
There was a problem hiding this comment.
Applied to all side-by-side comparisons: changed col2 → flex-col, moved package names into code block comments (# ggplot2 / # gglite), and changed all gglite code blocks from {r} to r so they aren't executed. Commit 0183556.
| ```{r, include = FALSE} | ||
| library(gglite) | ||
| ``` | ||
|
|
There was a problem hiding this comment.
we don't really run gglite in this vignette
| ```{r, include = FALSE} | |
| library(gglite) | |
| ``` |
There was a problem hiding this comment.
Removed the hidden library(gglite) chunk entirely since no code is evaluated in this vignette. Commit 0183556.
…t NEWS.md Agent-Logs-Url: https://github.com/yihui/gglite/sessions/c77ab966-61cd-4c36-862b-3a1d245844a6 Co-authored-by: yihui-bot <264330240+yihui-bot@users.noreply.github.com>
Two vignettes using the
litedown::vignetteengine: a grammar-of-graphics overview and a ggplot2 migration guide. Also adds convenience wrapper functions for coordinates and themes.Vignettes
vignettes/gglite.Rmd— Walks through each grammar layer (data → marks → encodings → scales → coordinates → transforms → facets → themes → components → interactions) with runnable examplesvignettes/ggplot2.Rmd— Concept mapping tables (geom→mark, scale functions, coords, themes), side-by-side ggplot2/gglite code comparisons (usingflex-collayout, non-evaluated gglite blocks), and a quick-reference cheat sheetNew API functions
coord_*()wrappers:coord_polar(),coord_theta(),coord_radial(),coord_radar(),coord_helix(),coord_parallel()— shortcuts forcoordinate(chart, type, ...)theme_*()wrappers:theme_classic(),theme_classicDark(),theme_light(),theme_dark(),theme_academy()— shortcuts fortheme_of(chart, type, ...)Package metadata
DESCRIPTION: addedVignetteBuilder: litedown, version bump 0.0.2 → 0.0.3