ggtile: Grob function: tile

Description Usage Arguments Details See Also Examples

View source: R/grobs-basic.r

Description

The tile grob will tile the plot surface as densly as possible, assuming that every tile is the same size. It is similar to levelplot or image.

Usage

1
ggtile(plot, aesthetics = list(), ..., data = NULL)

Arguments

plot

the plot object to modify

aesthetics

named list of aesthetic mappings, see details for more information

...

other options, see details for more information

data

data source, if not specified the plot default will be used

Details

Aesthetic mappings that this grob function understands:

These can be specified in the plot defaults (see ggplot) or in the aesthetics argument. If you want to modify the position of the points or any axis options, you will need to add a position scale to the plot. These functions start with ps, eg. pscontinuous or pscategorical

Other options:

See Also

ggrect, resolution

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
pp <- function (n,r=4) {
 x <- seq(-r*pi, r*pi, len=n)
 df <- expand.grid(x=x, y=x)
 df$r <- sqrt(df$x^2 + df$y^2)
 df$z <- cos(df$r^2)*exp(-df$r/6)
 df
}
p <- ggplot(pp(20), aes=list(x=x,y=y))
ggtile(p) #pretty useless!
ggtile(p, list(fill=z))
ggtile(p, list(height=abs(z), width=abs(z)))
ggtile(ggplot(pp(100), aes=list(x=x,y=y,fill=z)))
ggtile(ggplot(pp(100, r=2), aes=list(x=x,y=y,fill=z)))
p <- ggplot(pp(20)[sample(20*20, size=200),], aes=list(x=x,y=y,fill=z))
ggtile(p)

hadley/ggplot1 documentation built on Aug. 19, 2019, 2:42 p.m.