# It is convenient to have an object for the plot argument
if (FALSE) {
data(Theoph)
library(ggplo2)
pl <- qplot(Time, conc, data=Theoph, facets=~Subject,geom="line")
html_plot(pl,out=paste0(tempfile(),".html"))
# Base plots work a bit different and can be placed
# in the function directly or wrapped in a function
html_plot(plot(conc~Time,data=Theoph),out=tempfile(fileext=".html"))
pl <- function() {
plot(conc~Time,data=Theoph)
title(main="a plot")
}
html_plot(pl(),out=tempfile(fileext=".html"))
}
Run the code above in your browser using DataLab