I want to copy a plot to a grid object from an svg device.
grid.echo()
docs says that it echoes the current device but drawn using grid graphics.
However, the following does not work:
svg()
plot(1:10)
print(dev.cur())
grid.echo()
a = grid.grab()
dev.off()
print(dev.cur())
grid.draw(a)
The printout from the above is:
svg
2
null device
1
Warning message:
In grid.echo.recordedplot(recordPlot(), newpage, prefix, device) :
No graphics to replay
As you can see, the current device is the svg device right before grid.echo()
is called, but still it finds nothing to echo. a
returned by `grid.grab() is thus empty. I've tried the same thing with the pdf device with no success.
What am I doing wrong?
Is this your expected behaviour?