Skip to content

Instantly share code, notes, and snippets.

@lauratboyer
Created July 25, 2013 19:39
Show Gist options
  • Save lauratboyer/6083050 to your computer and use it in GitHub Desktop.
Save lauratboyer/6083050 to your computer and use it in GitHub Desktop.
Looks at current graphic device size, if it's not the specified width and height closes it and opens a new one.
check.dev.size <- function(ww,hh) {
if(dev.cur()==1){ dev.new(width=ww,height=hh)
} else {
ds <- dev.size()
if(round(ds[1],2)!=round(ww,2)
| round(ds[2],2)!=round(hh,2)) {
dev.off(); dev.new(width=ww,height=hh)} }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment