Skip to content

Commit

Permalink
Update spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhodge931 committed Jun 28, 2023
1 parent c26154a commit e66994a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 13 deletions.
5 changes: 3 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# ggblanket 2.0.9000

* Breaking: redesigned the themes, including their arguments.
* New theme functions: `gg_theme_light`, `gg_theme_dark` and `gg_theme_void`.
* New theme functions: `light_mode` and `dark_mode`.
* Breaking: removed `gg_theme`.
* Breaking: renamed `*_grid` arguments to `*_gridlines`.
* Breaking: removed `void` argument.
* Breaking: removed `gg_function`.
* Breaking: made `col_rescale` require a function (e.g. `scales::rescale()`).
* For raster, removed col aesthetic so that legend would work.
* Improved `gg_sf` default `alpha`.
* Supported `gg_sf` to work with non-standard named geometry.

Expand Down
23 changes: 15 additions & 8 deletions vignettes/articles/extending_further.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,12 @@ iris |>

As ggblanket wraps the `ggplot2::geom_sf` and `ggplot2::geom_raster` functions, spatial vector and array data can be visualised.

```{r}
```{r, fig.asp=0.33}
sf::st_read(system.file("shape/nc.shp", package = "sf"),
quiet = TRUE) |>
gg_sf(col = AREA,
pal = RColorBrewer::brewer.pal(9, "Blues"))
pal = RColorBrewer::brewer.pal(9, "Blues")) +
ggeasy::easy_remove_axes()
```

```{r}
Expand All @@ -301,16 +302,19 @@ stars::read_stars(system.file("tif/L7_ETMs.tif", package = "stars")) |>
y = y,
col = L7_ETMs.tif,
facet = band,
col_title = "",
theme = light_mode())
col_title = "") +
ggeasy::easy_remove_axes()
```

### 9. Use different fonts

The showtext and sysfonts packages support the use of different fonts from google. The `theme_*_mode` functions provide `base_family`, `title_family`, `subtitle_family` and `caption_family` arguments. Fonts can be identified on the Google fonts [website](https://fonts.google.com/).
The showtext and sysfonts packages support the use of different fonts from Google. The `theme_*_mode` functions provide `base_family`, `title_family`, `subtitle_family` and `caption_family` arguments. Fonts can be identified on the Google fonts [website](https://fonts.google.com/).

```{r, fig.asp = 0.75, fig.showtext = TRUE}
sysfonts::font_add_google("Covered By Your Grace", "grace")
sysfonts::font_add_google('Anton', 'anton')
sysfonts::font_add_google('Syne Mono', 'syne')
showtext::showtext_auto(enable = TRUE)
penguins |>
Expand All @@ -322,7 +326,11 @@ penguins |>
title = "Penguins body mass by flipper length",
subtitle = "Palmer Archipelago, Antarctica",
caption = "Source: Gorman, 2020",
theme = light_mode(base_family = "grace", base_size = 12))
pal = c("#2596be", "#fc7c24"),
theme = light_mode(
base_family = "grace",
title_family = "anton",
subtitle_family = "syne"))
showtext::showtext_auto(enable = FALSE)
```
Expand Down Expand Up @@ -552,7 +560,7 @@ d |>

#### ggeasy

The ggeasy package provides a lot of support for easily modifying themes.
The ggeasy package provides a lot of support for easily modifying themes. Removing axes often is useful for maps.

```{r}
penguins |>
Expand All @@ -561,7 +569,6 @@ penguins |>
y = body_mass_g,
col = sex) +
ggeasy::easy_remove_axes()
# theme(plot.margin = ggplot2::margin(t = 15, r = 17.5, b = 7.5, l = 15))
```

#### plotly::ggplotly
Expand Down
21 changes: 18 additions & 3 deletions vignettes/ggblanket.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ p1 <- penguins |>
col = sex,
pal = c("#2596be", "#fc7c24"),
x_breaks = scales::breaks_pretty(3),
title = "theme = theme_grey()",
title = "theme=theme_grey()",
theme = theme_grey())
p2 <- penguins |>
Expand Down Expand Up @@ -349,6 +349,21 @@ penguins |>
theme_set(light_mode())
```

```{r}
penguins |>
gg_point(
x = flipper_length_mm,
y = body_mass_g,
col = sex,
facet = species,
title = "Penguins body mass by flipper length",
subtitle = "Palmer Archipelago, Antarctica",
caption = "Source: Gorman, 2020",
pal = c("#2596be", "#fc7c24"),
theme = light_mode(base_size = 12))
```


### 10. Pretty defaults for symmetry

Where the orientation is normal (i.e. vertical):
Expand Down Expand Up @@ -426,7 +441,7 @@ penguins |>

### 12. Ability to add multiple geom_* layers

Users can make plots with multiple layers with ggblanket by adding on `ggplot2::geom_*` layers. The `gg_*` function puts the aesthetics within the wrapped `ggplot` function. Therefore, the aesthetics will inherit to any subsequent geom's added. Geom's will plot in order. The `gg_*` function will plot the associated geom as the first layer, and then other geoms will be plotted on top of it.
Users can make plots with multiple layers with ggblanket by adding on `ggplot2::geom_*` layers. The `gg_*` function puts the aesthetics within the wrapped `ggplot` function. Therefore, the aesthetics will inherit to any subsequent geoms added. Geoms will plot in order. The `gg_*` function will plot the associated geom as the first layer, and then other geoms will be plotted on top of it.

```{r}
penguins |>
Expand All @@ -441,7 +456,7 @@ If some geoms have a `col` aesthetic and some do not, then it is recommended to

If you do not want a col aesthetic in your bottom plot layer, but require it in subsequent layers - then you should use the `gg_blank` function. Subsequent `geom_*` layers where the col aesthetic is not required can have `col = NA` and/or `fill = NA` arguments - or use the `inherit.aes = FALSE` argument.

Note the plot scales are constructed without knowledge of subsequent layers. The `gg_*` function builds the x and y scales based on the `data`, `stat`, `x`, and `y` in the `gg_*` function. These scales can be adjusted to accomodate subsequent layers using the `*_include` or `*_limits` arguments.
Note the plot scales are constructed without knowledge of subsequent layers. The `gg_*` function builds the x and y scales based on the `data`, `stat`, `x`, and `y` in the `gg_*` function. These scales can be adjusted to accommodate subsequent layers using the `*_include` or `*_limits` arguments.

```{r, fig.asp=0.75}
d <- penguins |>
Expand Down

0 comments on commit e66994a

Please sign in to comment.