Stacks Image 20108

For Academics

Save a plot

It is useful to save R graphics with code, so the file creation and naming can be automated.

On a mac, hitting Cmd-S when a graph is displayed will save a pdf. However exporting to pdf (or other formats) using code gives more control. For example Cmd-S will save to the displayed dimensions of a canvas, which is a problem if a canvas contains many graphs because they may not b resolved well. A larger canvas can be defined for export.

pdf(file='1.pdf', width=15, height=18, pointsize=20)
par(mfrow=c(4,4)) #define columns and rows on canvas, each gets a graph
# code for graphs goes here
dev.off()

There are many more options, explored them with ?pdf

3D graphs are exported using:

rgl.snapshot("/Users/username/Desktop/graphName.png")
Previous Post 36 / 50 Post

Tag:

Sex chromosome papers RSS


The genome sequence of the Buff Arches, Habrosyne pyritoides (Hufnagel, 1766)
Link

The Evolutionarily Conserved Jasmonate Pathway Positively Affects Desiccation Tolerance on Syntrichia caninervis by Boosting Antioxidant Capacity
Link

The genome sequence of the nematode Ostertagia ostertagi (Stiles, 1892) (Rhabditida, Trichostrongylidae)
Link