output_graph | R Documentation |
output_graph
For PDF output, we want high-resolution static vector graphics but for HTML output, sometimes we want the interactivity provided by the plotly
library. Pass a ggplot2
object to this function, which will decide which output to produce.
output_graph(graph)
graph |
A |
Using plotly::ggplotly()
adds interactive features to standard ggplot output (for example, tooltips can display information about individual data points). The HTML output produced by ggplotly()
is, however, not valid if the destination output format for a report is either LaTeX or Word. This function checks the environment and routes a graph through ggplotly()
if at the command prompt or when knitting an HTML document. If knitting to LaTeX or Word, then standard ggplot2
static output will be used (e.g. PDF or PNG).
## Not run:
output_graph(p) # p is a ggplot object
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.