I would like to create a theme for all ggplot objects in R markdown. Hence, is it possible to tweak the chart output, e.g.
```{r}
ggplot(cars, aes(speed, dist)) + geom_point()
```
to add a theme when processing the document, e.g. ggplot_obj + theme_bw()?
I have looked into knitr hooks (http://yihui.name/knitr/hooks), but I can't figure out how to use it in combination with ggplot objects.
Thanks!
Use theme_set(theme_bw()) in a first invisible chunk.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With