Saving Plots in R — Part 2 of a Series

This is post #02 in a running series about plotting in R.

Though the docs are relatively clear on how to save an R plot to disk in a variety of formats, I had some trouble figuring out how because I googled the wrong words. In the hope that this can help someone in the future, here’s how I generated the plots for the last post and saved them to disk:

> png(filename='plot01.04.png', type='quartz')
> plot(x=s$x, y=s$y, type='b', col='blue', xlim=c(20,30), ylim=c(6,10),
+	xlab='x in [20,30]', ylab='y in [6,10]', main='Basic Plotting Sample, Filtered')
>
> dev.off()

It’s really as simple as using png or jpeg depending on your desired filetype.

This entry was posted in Plotting, R, Visualization and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>