diff --git a/quarto.qmd b/quarto.qmd index 23ef0e8..e0e256f 100644 --- a/quarto.qmd +++ b/quarto.qmd @@ -429,7 +429,7 @@ comma(.12358124331) The figures in a Quarto document can be embedded (e.g., a PNG or JPEG file) or generated as a result of a code chunk. -To embed an image from an external file, you can use the Insert menu in RStudio and select Figure / Image. +To embed an image from an external file, you can use the Insert menu in the Visual Editor in RStudio and select Figure / Image. This will pop open a menu where you can browse to the image you want to insert as well as add alternative text or caption to it and adjust its size. In the visual editor you can also simply paste an image from your clipboard into your document and RStudio will place a copy of that image in your project folder. @@ -448,7 +448,7 @@ We recommend three of the five options: Then in individual chunks, only adjust `fig-asp`. - Control the output size with `out-width` and set it to a percentage of the line width. - We suggest to `out-width: "70%"` and `fig-align: center`. + We suggest `out-width: "70%"` and `fig-align: center`. That gives plots room to breathe, without taking up too much space. - To put multiple plots in a single row, set the `layout-ncol` to 2 for two plots, 3 for three plots, etc. @@ -490,7 +490,7 @@ plot ``` If you want to make sure the font size is consistent across all your figures, whenever you set `out-width`, you'll also need to adjust `fig-width` to maintain the same ratio with your default `out-width`. -For example, if your default `fig-width` is 6 and `out-width` is 0.7, when you set `out-width: "50%"` you'll need to set `fig-width` to 4.3 (6 \* 0.5 / 0.7). +For example, if your default `fig-width` is 6 and `out-width` is "70%", when you set `out-width: "50%"` you'll need to set `fig-width` to 4.3 (6 \* 0.5 / 0.7). Figure sizing and scaling is an art and science and getting things right can require an iterative trial-and-error approach. You can learn more about figure sizing in the [taking control of plot scaling blog post](https://www.tidyverse.org/blog/2020/08/taking-control-of-plot-scaling/). @@ -510,12 +510,12 @@ In that case, set `fig-format: "png"` to force the use of PNGs. They are slightly lower quality, but will be much more compact. It's a good idea to name code chunks that produce figures, 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 it 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). +The chunk label is used to generate the file name of the graphic on disk, so naming your chunks makes it much easier to pick out plots and reuse in other circumstances (e.g., if you want to quickly drop a single plot into an email). ### Exercises 1. Open `diamond-sizes.qmd` in the visual editor, find an image of a diamond, copy it, and paste it into the document. Double click on the image and add a caption. Resize the image and render your document. Observe how the image is saved in your current working directory. -2. Edit the label of the code chunk in `diamond-sizes.qmd` that generates a plot to start with the suffix `fig-` and add a caption to the figure with the chunk option `fig-cap`. Then, edit the text above the code chunk to add a cross-reference to the figure with Insert \> Cross Reference. +2. Edit the label of the code chunk in `diamond-sizes.qmd` that generates a plot to start with the prefix `fig-` and add a caption to the figure with the chunk option `fig-cap`. Then, edit the text above the code chunk to add a cross-reference to the figure with Insert \> Cross Reference. 3. Change the size of the figure with the following chunk options, one at a time, render your document, and describe how the figure changes. a. `fig-width: 10` @@ -555,7 +555,7 @@ Each provides a set of tools for returning formatted tables from R code. 1. Open `diamond-sizes.qmd` in the visual editor, insert a code chunk, and add a table with `knitr::kable()` that shows the first 5 rows of the `diamonds` data frame. 2. Display the same table with `gt::gt()` instead. -3. Add a chunk label that starts with the suffix `tbl-` and add a caption to the table with the chunk option `tbl-cap`. Then, edit the text above the code chunk to add a cross-reference to the table with Insert \> Cross Reference. +3. Add a chunk label that starts with the prefix `tbl-` and add a caption to the table with the chunk option `tbl-cap`. Then, edit the text above the code chunk to add a cross-reference to the table with Insert \> Cross Reference. ## Caching {#sec-caching} @@ -677,9 +677,6 @@ If you publish the HTML file on a hosting platform (e.g., QuartoPub,