File: background_image.Rd

package info (click to toggle)
r-cran-ggpubr 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 3,240 kB
  • sloc: makefile: 2
file content (35 lines) | stat: -rw-r--r-- 899 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/background_image.R
\name{background_image}
\alias{background_image}
\title{Add Background Image to ggplot2}
\usage{
background_image(raster.img)
}
\arguments{
\item{raster.img}{raster object to display, as returned by the function
\code{readPNG()}[in \code{png} package] and \code{readJPEG()} [in \code{jpeg} package].}
}
\description{
Add background image to ggplot2.
}
\examples{
\dontrun{
install.packages("png")

# Import the image
img.file <- system.file(file.path("images", "background-image.png"),
                       package = "ggpubr")
img <- png::readPNG(img.file)

# Plot with background image
ggplot(iris, aes(Species, Sepal.Length))+
 background_image(img)+
 geom_boxplot(aes(fill = Species), color = "white")+
 fill_palette("jco")
 }

}
\author{
Alboukadel Kassambara <alboukadel.kassambara@gmail.com>
}