resolveRasterSize

0th

Percentile

Utility function to resolve the size of a raster grob

Determine the width and height of a raster grob when one or both are not given explicitly.

The result depends on both the aspect ratio of the raster image and the aspect ratio of the physical drawing context, so the result is only valid for the drawing context in which this function is called.

Keywords
dplot
Usage
resolveRasterSize(x)
Arguments
x

A raster grob

Details

A raster grob can be specified with width and/or height of NULL, which means that the size at which the raster is drawn will be decided at drawing time.

Value

A raster grob, with explicit width and height.

See Also

grid.raster

Aliases
  • resolveRasterSize
Examples
library(grid) # Square raster rg <- rasterGrob(matrix(0)) # Fill the complete page (if page is square) grid.newpage() resolveRasterSize(rg)$height grid.draw(rg) # Forced to fit tall thin region grid.newpage() pushViewport(viewport(width=.1)) resolveRasterSize(rg)$height grid.draw(rg)
Documentation reproduced from package grid, version 3.4.1, License: Part of R 3.4.1

Community examples

Looks like there are no examples yet.