Skip to content

Use vacant ggplot2 facets for advertising

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

nacnudus/ggbillboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ggbillboard

A package to fill vacant ggplot2 facets with images. You could advertise your consultancy, for example.

Installation

You can install the development version of ggbillboard from GitHub with:

# install.packages("remotes")
remotes::install_github("nacnudus/ggbillboard")

Example

This is a basic example which shows you how to solve a common problem:

library(ggbillboard)

library(ggplot2)

library(png) # To load png image files
library(jpeg) # To load jpeg image files

img1 <- readPNG(system.file("img", "Rlogo.png", package="ggbillboard"))
img2 <- readJPEG(system.file("img", "spongebob.png", package="ggbillboard"))

# Images must be converted to grobs.
g1 <- grid::rasterGrob(img1, interpolate=TRUE)
g2 <- grid::rasterGrob(img2, interpolate=TRUE)

# Create a plot
p1 <-
  ggplot(economics_long, aes(date, value)) +
  geom_line() +
  facet_wrap(vars(variable), scales = "free_y", nrow = 2)

# Fill the vacant facet with an image
billboard(p1, g1)

# If multiple facets are vacant, you can use more than one image, and they will
# be recycled to fill all vacant facets.
p2 <-
  ggplot(ChickWeight, aes(Time, weight)) +
  geom_point() +
  facet_wrap(~ Diet, ncol = 3)

billboard(p2, list(g1, g2))

billboard(p2, g1)

About

Use vacant ggplot2 facets for advertising

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages