File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1
1
local({
2
2
requireNamespace(" jsonlite" )
3
+ requireNamespace(" svglite" )
3
4
args <- commandArgs(trailingOnly = TRUE )
4
5
exprs <- parse(text = args , keep.source = FALSE )
5
6
env <- new.env()
6
7
for (expr in exprs ) {
7
8
eval(expr , env )
8
9
}
9
10
10
- plot_file <- file.path(tempdir(), " plot" )
11
11
null_dev_id <- c(pdf = 2L )
12
12
null_dev_size <- c(7 + pi , 7 + pi )
13
13
@@ -38,15 +38,16 @@ local({
38
38
line <- readLines(con , n = 1 )
39
39
request <- jsonlite :: fromJSON(line )
40
40
cat(sprintf(" [%s]\n %s\n " , request $ time , request $ expr ))
41
+ res <- list ()
41
42
str <- tryCatch({
42
43
expr <- parse(text = request $ expr )
43
44
out <- withVisible(eval(expr , globalenv()))
44
45
if (check_null_dev()) {
45
46
record <- recordPlot()
46
- svglite :: svglite(plot_file , width = 10 , height = 6 )
47
+ plot_file <- tempfile(fileext = " .svg" )
48
+ svglite :: svglite(plot_file , width = 12 , height = 8 )
47
49
replayPlot(record )
48
- dev.off()
49
- dev.off()
50
+ graphics.off()
50
51
res <- list (
51
52
type = " plot" ,
52
53
result = plot_file
You can’t perform that action at this time.
0 commit comments