Resizing images in RMarkdown

后端 未结 4 868
迷失自我
迷失自我 2021-02-04 12:37

I\'m trying to convert a R markdown .Rmd document to .pdf. Unfortunately, the images are too large. Is there any way to change the size of the image?

4条回答
  •  猫巷女王i
    2021-02-04 13:28

    I found a comfortable solution by the combination of fig.height, fig.width, dpi and out.width.

    You can set global parameters at the top by:

    knitr::opts_chunk$set(out.width="400px", dpi=120)

    You can overwrite these properties in any chunk, just set the parameters you need.

    dpi increases the quality image, so you have to adjust by the other parameters.

    out.width adjust the size once the image is created.

    Decreasing values in fig.height and fig.width will cause the text/numbers to be bigger (same as reducing image window in Rstudio)

提交回复
热议问题