Skip to content

Instantly share code, notes, and snippets.

@mbacou
Created March 25, 2013 16:27
Show Gist options
  • Save mbacou/5238419 to your computer and use it in GitHub Desktop.
Save mbacou/5238419 to your computer and use it in GitHub Desktop.
R: Export multiple graphs to PNG or SVG in one step
# Export multiple graphs to PNG or SVG at once
png("/out/YieldTarget_%d.png")
dotplot(cropSPAM~value,
plot[!plot$cropSPAM %in% c("BANP", "SUGC"),],
group=variable,
main=list("Mean GAEZ Low and High Input Yield Potentials \nagainst Mean SPAM Yield", cex=.9),
xlab="yield (kg/ha)",
pch=c(1,1,3),
cex=1.2,
col=c("green", "red", "orange"),
key=list(
text=list(c("GAEZ low", "GAEZ high", "SPAM yield"), cex=.9),
points=list(pch=c(1,1,3), col=c("green", "red", "orange")),
space="right",
transparent=TRUE,
horizontal=TRUE)
)
bwplot(cropGAEZ~rl|ISO3,
gaez.y.norm[cropGAEZ %in% levels(cropGAEZ)[1:4]],
main=list("GAEZ Low and High Input Yield Potentials for South Asia", cex=.9),
xlab="yield (mT/ha)"
)
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment