The external images are unaffected by the fig.width argument (which is set to 7 inches by default). This is the default for images using the include_graphics function – original px width * 50%. You'll see below that the default for images is to display them at ½ their original size – you will see below that this is due to the fig.retina = 2 setting (making the same image ½ the size doubles the resolution). How images and figures in the HTML document are affected by using defaults Second, although you can technically include an image in a markdown document using standard HTML image tags ( ), using include_graphics will respect image settings listed in the R chunks like out.width and out.height.Īs mentioned above, the figure is included by creating a new plot on the fly with the ggplot2 package. First, the function is document format agnostic – meaning it can work with LaTeX or Markdown documents. We are using include_graphics for two reasons. img1_path ) or using markdown directly ( !(imagepath)). The raw image on disk has a width of 1000px and height of 667px (300 dpi). Library(png) # For grabbing the dimensions of png files Start by loading the packages library(knitr) # For knitting document and include_graphics function For example library(jpeg) readJPEG(img1). NOTE: you can use the same process to examine jpegs, simply swap out png for jpeg.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |