geomImshow

fun geomImshow(rasterData: RasterData, cmap: List<String>? = null, norm: Boolean = true, vmin: Number? = null, vmax: Number? = null, extent: List<Number>? = null, showLegend: Boolean = true, colorBy: String = "paint_c", cguide: Any? = null): Feature

Displays image specified by RasterData.

This geom is not as flexible as geomRaster() or geomTile() but vastly superior in the terms of rendering efficiency.

Notes

This geom doesn't understand any aesthetics. It doesn't support color scales either.

Examples

Return

Layer object.

Parameters

rasterData

Specifies image type, size, and pixel values. See RasterData.create.

cmap

A list of colors to use as a colormap for greyscale images. Colors can be specified as hex strings ("#RRGGBB", "#RGB"), "rgb(r, g, b)", "rgba(r, g, b, a)", or named colors (e.g. "red"). The greyscale values will be quantized to map to the provided colors. This parameter is ignored for RGB(A) images. Use ColorScale.palette to generate a color list from any color scale, for example: cmap = scaleColorViridis().palette(256).

norm

default = true.

  • true - luminance values in gray-scale image will be scaled to [0-255] range using a linear scaler.

  • false - disables scaling of luminance values in gray-scale image. This parameter is ignored for RGB(A) images.

vmin

default = null. Defines the data range used for luminance normalization in gray-scale images. This parameter is ignored for RGB(A) images or if parameter norm = false.

vmax

default = null. Defines the data range used for luminance normalization in gray-scale images. This parameter is ignored for RGB(A) images or if parameter norm = false.

extent

default = listOf(-0.5, ncol-0.5, -0.5, nrow-0.5). List of 4 numbers: (left, right, bottom, top). Defines image's bounding box in terms of the "data coordinates".

  • left, right: coordinates of pixels outer edge along the x-axis for pixels in the 1-st and the last column.

  • bottom, top: coordinates of pixels outer edge along the y-axis for pixels in the 1-st and the last row.

showLegend

default = true. Greyscale images only.

  • false - do not show legend for this layer.

colorBy

default="paint_c" ("fill", "color", "paint_a", "paint_b", "paint_c"). Define the color-aesthetic used by the legend shown for a greyscale image.

cguide

default = null. A result of guideColorbar() call. Use to customize the colorbar for greyscale images.