Skip to content

Commit f547e16

Browse files
committed
Use svglite for plot
1 parent 2f6e52b commit f547e16

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

R/notebook.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ local({
77
eval(expr, env)
88
}
99

10-
plot_file <- file.path(tempdir(), "plot.png")
10+
plot_file <- file.path(tempdir(), "plot")
1111
null_dev_id <- c(pdf = 2L)
1212
null_dev_size <- c(7 + pi, 7 + pi)
1313

@@ -43,7 +43,7 @@ local({
4343
out <- withVisible(eval(expr, globalenv()))
4444
if (check_null_dev()) {
4545
record <- recordPlot()
46-
png(filename = plot_file)
46+
svglite::svglite(plot_file, width = 10, height = 6)
4747
replayPlot(record)
4848
dev.off()
4949
dev.off()

src/notebook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ export class RNotebookProvider implements vscode.NotebookContentProvider, vscode
316316
cell.outputs = [{
317317
outputKind: vscode.CellOutputKind.Rich,
318318
data: {
319-
'image/png': fs.readFileSync(output.result, 'base64'),
319+
'image/svg+xml': fs.readFileSync(output.result).toString(),
320320
}
321321
}];
322322
break;

0 commit comments

Comments
 (0)