Skip to content

Commit

Permalink
update theme section, added theming packages tp "More resources" at t…
Browse files Browse the repository at this point in the history
…he end

closes datacarpentry#641
  • Loading branch information
Teebusch committed Oct 26, 2020
1 parent 05786ed commit b992126
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions 04-visualization-ggplot2.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -460,15 +460,13 @@ using the `theme_bw()` function:
theme_bw()
```

In addition to `theme_bw()`, which changes the plot background to white,
**`ggplot2`** comes with several other themes which can be useful to quickly
change the look of your visualization. The complete list of themes is available
at <https://ggplot2.tidyverse.org/reference/ggtheme.html>. `theme_minimal()` and
`theme_light()` are popular, and `theme_void()` can be useful as a starting
point to create a new hand-crafted theme.

The [ggthemes](https://jrnold.github.io/ggthemes/reference/index.html) package
provides a wide variety of options.
In addition, **`ggplot2`** comes with several other themes which can be useful
to quickly change the look of your visualization. Popular options are
`theme_minimal()` and `theme_light()`, and `theme_void()` can be useful as a
starting point to create a new hand-crafted theme.The complete list of themes is
available [here](https://ggplot2.tidyverse.org/reference/ggtheme.html).
Additional themes are available in packages such as
[ggthemes](https://jrnold.github.io/ggthemes/reference/index.html).

> ### Challenge
>
Expand Down Expand Up @@ -624,13 +622,9 @@ website](https://patchwork.data-imaginist.com/)
After creating your plot, you can save it to a file in your favorite format. The
Export tab in the **Plot** pane in RStudio will save your plots at low
resolution, which will not be accepted by many journals and will not scale well
for posters. The [**`ggplot2`** extensions
website](https://exts.ggplot2.tidyverse.org/) provides a list of packages that
extend the capabilities of **`ggplot2`**, including additional themes.

Instead, use the `ggsave()` function, which allows you easily change the
dimension and resolution of your plot by adjusting the appropriate arguments
(`width`, `height` and `dpi`):
for posters. Instead, use the `ggsave()` function, which allows you easily
change the dimension and resolution of your plot by adjusting the appropriate
arguments (`width`, `height` and `dpi`):

```{r ggsave-example, eval = FALSE, purl = FALSE}
my_plot <- ggplot(data = yearly_sex_counts,
Expand Down Expand Up @@ -666,5 +660,19 @@ saved plot.
## https://www.rstudio.com/wp-content/uploads/2015/08/ggplot2-cheatsheet.pdf
```

## More Resources

- The [**`ggplot2`** extensions website](https://exts.ggplot2.tidyverse.org/)
provides a list of packages that extend the capabilities of **`ggplot2`**,
including additional themes.

- There are several packages that try to make configuring ggplots easier.
These include [**`equisse`**](https://github.com/dreamRs/esquisse),
[**`ggplotgui`**](https://github.com/gertstulp/ggplotgui),
[**`ggquickeda`**](https://github.com/smouksassi/ggquickeda),
[**`ggthemeassist`**](https://github.com/calligross/ggthemeassist),
[**`ggplotAssist`**](https://github.com/cardiomoon/ggplotAssist), and
[**`ggedit`**](https://github.com/yonicd/ggedit)

```{r, child="_page_built_on.Rmd"}
```

0 comments on commit b992126

Please sign in to comment.