Exporting an image from inline previews

rmarkdown
rstudio
effective-practice

#1

It’s occasionally handy to get a PNG file of a figure to share in an email, on twitter, etc. In the pre-markdown days I would use the export button in the plots viewer to do this. How do I (efficiently) do this from inline output?

I know I can use ggplot2::ggsave(), or go into the settings for the document and change inline output to console output. But surely there’s a way to do it from inside the document without messing up the real purpose of the document?

I’m still using 1.0.143 on this machine … maybe that’s the answer.


#2

AHA! right click gives this menu of tantalizing options. Copy image works as advertised. Download image? Maybe, but haven’t been able to find resulting image.


#3

There’s actually no straightforward way to do this, unfortunately. The easiest workaround is to click Preview, and then to open the preview in a browser window. From there you can easily save the image to disk.

I’ve filed an issue here:


#4

This may be considered cheating, but have you considered making a Command + Shift + 4 selective screen capture


#5

Cheating is always an acceptable solution ! But the resolution of a scrrenshot often seems poor compared to an exported file.