Skip to content

Commit

Permalink
workaround for "Error in dev.hold : cannot open file 'Rplots.pdf'"
Browse files Browse the repository at this point in the history
  • Loading branch information
dpavlushko committed Jun 9, 2016
1 parent 20548d9 commit 3568d09
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/clustering.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,16 @@ tool_exec <- function(in_params, out_prams)
if (!is.null(out_dens) && out_dens != "NA")
{
arc.progress_label("Calculating density...")
options(device="pdf")
tmp_file = tempfile("density", fileext = ".pdf")
options(onefile=FALSE)
pdf(tmp_file)

grid.n <- 100
grid <- surfacePlot(verbose=T, data.xy, parameters = bestModel$parameters, type = "image", what = "density", grid=grid.n, nlevels = 8, transformation = "none", ask=F)
dev.off()
options(device="windows")
options(onefile=NULL)
#file.remove(tmp_file)
xy <-list(x = unlist(lapply(grid$x, function(x) rep(x, grid.n))),
y = rep(grid$y, grid.n))
arc.progress_label("Writing density dataset...")
Expand Down

0 comments on commit 3568d09

Please sign in to comment.