Present/Save Interactive Plot for Publication in .html,.pdf or .docx
Source: R/plot_EPR_present_interact.R
plot_EPR_present_interact.RdAdd the interactive plots (see plot_EPR_Specs2D_interact or plot_EPR_Specs3D_interact)
to various document formats like .html, .pdf or .docx. Function is based on the
saveWidget as well as on the webshot with the help
of knitr package functions. Depending on the output format, plot is saved
in working/actual directory either as .html or as .png.
The file name inherits the name of the object/variable (see argument p and example). Afterwards, during
the R markdown or Quarto
processing, the image is automatically attached to the document in the above-described format. Therefore, this function is quite
handy in interactive notebooks (such as .Rmd or .qmd, please also consult
the create_qmdReport_proj function).
Value
Interactive plot format corresponding to that of the output document. If the desired document
format \(\equiv\) .html, interactive plotly graph is saved in working/actual directory
in the same format. Otherwise, for .pdf and .docx
it is saved as .png bitmap with the resolution of size.with\(\cdot\)res.ppi x
size.height\(\cdot\)res.ppi.
Examples
if (FALSE) { # \dontrun{
## plotting EPR spectrum of verdazyl radical (`verdazyl.rad.data`),
## where the actual plot is stored under
## the `verdazyl.epr.plot.interact` variable name
verdazyl.epr.plot.interact <-
plot_EPR_Specs2D_interact(data.spectra = verdazyl.rad.data)
#
## afterwards, it is automatically transformed and attached
## to document with the desired format by `knitr`
plot_EPR_present_interact(verdazyl.epr.plot.interact)
#
## remaining image files are stored in the working directory
} # }