Add naming advice from @jennybc

This commit is contained in:
hadley 2016-08-17 16:33:34 -05:00
parent 172cc49dbe
commit 322e3981e5
1 changed files with 2 additions and 0 deletions

View File

@ -564,6 +564,8 @@ To add a caption to the plot, use `fig.cap`. In RMarkdown this will change the f
If you're producing pdf output, the default graphics type is PDF. This a good default because PDFs are high quality vector graphics. However, they can produce very large and slow plots if you are displaying thousands of points. In that case, set `dev = "png"` to force the use of PNGs. They are slightly lower quality, but will be much more compact.
It's a good idea to give figure producing chunks names, even if you don't routinely label other chunks. The chunk label is used to generate the file name of the graphic on disk, so naming your chunks makes much easier to pick out plots and reuse in other circumstances (i.e. if you want to quickly drop a single plot into an email or a tweet).
## Learning more
The absolute best place to learn more is the ggplot2 book: [_ggplot2: Elegant graphics for data analysis_](https://amzn.com/331924275X). It goes into much more depth about the underlying theory, and has many more examples of how to combine the individual pieces to solve practical problems. Unfortunately the book is not available online for free, although can find the source code at <https://github.com/hadley/ggplot2-book>.