How do I include plots made with ggplot2 (through RCall) in html reports through Weave?
I try this (which works in a Jupyter notebook):
using RCall, DataFrames
d = DataFrame(x = [1,2,3], y = [4,5,6])
@rput d
@rlibrary ggplot2
ggplot(d, aes(x=:x,y=:y)) + geom_line()
and process it like this: using Weave; weave("test.jmd"; doctype = "md2html")
It gives this output:
I can work around it like this:
using RCall, DataFrames
d = DataFrame(x = [1,2,3], y = [4,5,6])
@rput d
R"""
library(ggplot2)
p <- ggplot(d, aes(x=x,y=y)) + geom_line()
png("plot01.png")
print(p)
dev.off()
"""
Then in the markdown put:
![plot01](plot01.png)
But that is not very satisfactory, as I need to manage filenames myself, and the plot is not embedded in the html output as native julia plots are.
Has anybody found a way around this?