This function makes a HTML document including the defined plots
html_plot(
plot,
out,
title = "plot",
titlepr = NULL,
footnote = "",
pwidth = 1000,
pheight = 600,
res = NULL,
fontsize = 12,
units = "px",
rawout = paste0(out, ".rawhtml"),
cleancur = FALSE,
...
)plot object or function call that creates plot to be printed to file
filename for the output HTML file
character string to define the title of the table which will be added to the caption
character string to define the prefix of the table title. Can be used to create custom table numbering
character string with the footnote to be placed in the footer of the page (HTML coding can be used for example to create line breaks)
numeric indicating the width of the plot to be generated in pixels
numeric indicating the height of the plot to be generated in pixels
numeric indicating the resolution of the plot, if set to NULL it will adapt the value according height of the plot
character string with the default font or pointsize passed through to png function
character string with the units to use for plot width and height passed through to png function
character string with the name of the raw HTML file to generate (e.g. only plotting code) In case NULL no raw output will be generated. In order to combine results the filename should end in .raw.html
logical indicating if the available plots should be deleted before creating new ones
additional arguments passed through to html_doc(). Most important are template, rendlist, css and show
The function returns a HTML file (or writes output to console)
# It is convenient to have an object for the plot argument
if (FALSE) { # \dontrun{
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"))
} # }