Description Usage Arguments Value Examples
Generate a small plot that will be enlarged in a modal when clicked
1 2 3 4 5 6 7 8 9 10 | enlarge_plot(
plot,
large_plot = plot,
plot_name = NULL,
width_small = 2,
height_small = 2,
width_large = 7,
height_large = 7,
...
)
|
plot |
a plot |
large_plot |
a larger version of the same plot. defaults to the first plot if left empty, but this only works for ggplot2 and similar, not base plots |
plot_name |
optional: specify a meaningful plot name (needs to be unique in the document) |
width_small |
width for the small plot |
height_small |
height for the small plot |
width_large |
width for the large plot |
height_large |
height for the large plot |
... |
passed to |
Returns markdown/HTML text with class "knit_asis"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
if(!requireNamespace("pkgdown", quietly = TRUE) || !pkgdown::in_pkgdown()) {
# will generate files in a temporary directory
if (requireNamespace("ggplot2")) {
dist <- ggplot2::qplot(stats::rbeta(200, 3, 4))
enlarge_plot(dist,
large_plot = dist + ggplot2::theme_classic(base_size = 18))
} else {
graphics::hist(stats::rbeta(200, 3, 4))
dist <- grDevices::recordPlot()
enlarge_plot(dist)
}
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.