geom_tile
where
all tiles are the same size. It is implemented highly
efficiently using the internal rasterGrob
function.geom_raster(mapping = NULL, data = NULL,
stat = "identity", position = "identity", hjust = 0.5,
vjust = 0.5, interpolate = FALSE, ...)
TRUE
interpolate linearly,
if FALSE
(the default) don't interpolate.aes
or aes_string
. Only
needs to be set at the layer level if you are overriding
the plot defaults.# For the special cases where it is applicable, geom_raster is much # faster than geom_tile: pp200 <- pp(200) base <- ggplot(pp200, aes(x, y, fill = z)) benchplot(base + geom_raster()) benchplot(base + geom_tile())
# justification df <- expand.grid(x = 0:5, y = 0:5) df$z <- runif(nrow(df)) # default is compatible with geom_tile() ggplot(df, aes(x, y, fill = z)) + geom_raster() # zero padding ggplot(df, aes(x, y, fill = z)) + geom_raster(hjust = 0, vjust = 0)
geom_raster
add a vertical and
horizontal padding. The size of padding depends on the
resolution of data. If you want to manually set the
padding (e.g. want zero-padding), you can change the
behavior by setting hpad
and vpad
.