Skip to content

Add two package vignettes, coord_*() and theme_*() wrappers#7

Merged
yihui-bot merged 3 commits intomainfrom
copilot/add-vignettes-for-gglite
Mar 31, 2026
Merged

Add two package vignettes, coord_*() and theme_*() wrappers#7
yihui-bot merged 3 commits intomainfrom
copilot/add-vignettes-for-gglite

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 31, 2026

Two vignettes using the litedown::vignette engine: 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 examples
  • vignettes/ggplot2.Rmd — Concept mapping tables (geom→mark, scale functions, coords, themes), side-by-side ggplot2/gglite code comparisons (using flex-col layout, non-evaluated gglite blocks), and a quick-reference cheat sheet

New API functions

  • coord_*() wrappers: coord_polar(), coord_theta(), coord_radial(), coord_radar(), coord_helix(), coord_parallel() — shortcuts for coordinate(chart, type, ...)
  • theme_*() wrappers: theme_classic(), theme_classicDark(), theme_light(), theme_dark(), theme_academy() — shortcuts for theme_of(chart, type, ...)

Package metadata

  • DESCRIPTION: added VignetteBuilder: litedown, version bump 0.0.2 → 0.0.3

Comment thread vignettes/gglite.Rmd Outdated
Comment on lines +9 to +11
```{r, include = FALSE}
library(gglite)
```
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.

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

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.

Moved library(gglite) from the hidden chunk to the first code chunk where gglite is used (the "Data and encodings" section). Commit 0183556.

Comment thread vignettes/ggplot2.Rmd Outdated
| `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')` | |
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.

we should provide wrapper functions coord_*() in gglite, too; coordinate('polar') is not easy to type and can't autocomplete

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.

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.

Comment thread vignettes/ggplot2.Rmd Outdated
| `coord_flip()` | `coord_transpose()` | |
| `coord_polar()` | `coordinate('polar')` | |
| `facet_wrap()` / `facet_grid()` | `facet_rect()` / `facet_circle()` | |
| `theme_minimal()` | `theme_of('light')` | |
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.

we should provide wrapper functions theme_*() in gglite

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.

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.

Comment thread vignettes/ggplot2.Rmd Outdated

## Building blocks: geom → mark

Every ggplot2 `geom_*()` has a corresponding `mark_*()` in gglite. Here are the
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.

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

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.

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.

Comment thread NEWS.md Outdated
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.
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.

don't touch news for v0.1

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.

Reverted NEWS.md to its original state. Commit 0183556.

Comment thread vignettes/ggplot2.Rmd Outdated
Comment on lines +71 to +87
::: {.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()
```

:::
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.

use the div class flex-col; move package names into code blocks; don't run gglite code blocks r instead of {r}

Suggested change
::: {.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

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.

Applied to all side-by-side comparisons: changed col2flex-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.

Comment thread vignettes/ggplot2.Rmd Outdated
Comment on lines +9 to +12
```{r, include = FALSE}
library(gglite)
```

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.

we don't really run gglite in this vignette

Suggested change
```{r, include = FALSE}
library(gglite)
```

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.

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>
Copilot AI changed the title Add two package vignettes (overview and ggplot2 comparison) Add two package vignettes, coord_*() and theme_*() wrappers Mar 31, 2026
Copilot AI requested a review from yihui-bot March 31, 2026 04:53
@yihui-bot yihui-bot marked this pull request as ready for review March 31, 2026 05:02
@yihui-bot yihui-bot merged commit 6b9090f into main Mar 31, 2026
5 checks passed
@yihui-bot yihui-bot deleted the copilot/add-vignettes-for-gglite branch March 31, 2026 05:03
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