Description Usage Arguments Examples
When there are more facets than categories of data, fill the vacant facets with images.
1 |
plot |
A ggplot object |
images |
A single image grob or a list of image grobs (see examples). |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | if (all(c(require("png"), require("jpeg")))) {
library(ggplot2)
img1 <- readPNG(system.file("img", "Rlogo.png", package="ggbillboard"))
img2 <- readJPEG(system.file("img", "spongebob.png", package="ggbillboard"))
g1 <- grid::rasterGrob(img1, interpolate=TRUE)
g2 <- grid::rasterGrob(img2, interpolate=TRUE)
p1 <-
ggplot(economics_long, aes(date, value)) +
geom_line() +
facet_wrap(vars(variable), scales = "free_y", nrow = 2)
billboard(p1, g1)
billboard(p1, list(g1))
p2 <-
ggplot(ChickWeight, aes(Time, weight)) +
geom_point() +
facet_wrap(~ Diet, ncol = 3)
billboard(p2, list(g1, g2))
billboard(p2, list(g2, g1))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.