Saving Plots and Images in R


If you generate a plot in R and want to save it, then you would typically use the following protocol:

png(file = FILEPATH)

plot(    )

Unfortunately, using this approach on the Grid does not work for the most common image types (PNG, JPG, and TIFF). However, you may store your plots as BMP or bitmap. To do so, follow this syntax:

bitmap(file = FILEPATH)

plot(    )

To view your plots, you may either transfer the files to your local machine, or map/mount the Grid folder to your local PC/Mac, then view the files as you would any other.

For further information on either option, please visit

Example Working Code

The following code will generate a histogram with light green bars. The resulting bitmap will be saved as “testplot.bmp” to your home directory (“~/” denotes home directory)

x=rnorm(50, mean=0, sd=1)


hist(x, breaks=10, col=’lightgreen’)