Quantcast
Channel: Category Name
Viewing all articles
Browse latest Browse all 5971

Useful tricks when including images in Rmarkdown documents

$
0
0

Rmarkdown is an enormously useful system for combining text, output and graphics generated by R into a single document. Images, in particular, are a powerful means of communication in a report, whether they be data visualizations, diagrams, or pictures. To maximize the power of those images, Zev Ross has created a comprehensive list of tips and tricks for working with images in R markdown documents. Those tips include:

While Zev's guide focuses on manipulating images as generated by R, this might also be a good time to revisit these tips on making the graphics themselves as attractive and useful as possible. Although written many years ago, most of these tips are still relevant, in particular:

  • If you plan to print (or these days, view on high-resolution displays), use PDF output
  • Use PNG for R graphics output, and use a high-resolution if you plan to print. Don't ever use JPG for R graphics output.
  • Think about the aspect ratio of your graphics.
  • Remove unused whitespace around your graphics (more of an issue for base R grahics; ggplot2 handles this pretty well already).

You may also find the Rmarkdown cheat sheet helpful if you're working with Rmarkdown documents.

ZevRoss Technical Blog: Tips and tricks for working with images and figures in R Markdown documents


Viewing all articles
Browse latest Browse all 5971

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>