geomLabel

constructor(data: Map<*, *>? = null, stat: StatOptions = Stat.identity, position: PosOptions = positionIdentity, showLegend: Boolean = true, manualKey: Any? = null, sampling: SamplingOptions? = null, tooltips: TooltipOptions? = null, map: SpatialDataset? = null, mapJoin: <Error class: unknown class><Any, Any>? = null, useCRS: String? = null, x: Number? = null, y: Number? = null, label: String? = null, alpha: Number? = null, color: Any? = null, fill: Any? = null, size: Number? = null, family: String? = null, fontface: String? = null, hjust: Any? = null, vjust: Any? = null, angle: Number? = null, lineheight: Number? = null, labelFormat: String? = null, naText: String? = null, nudgeX: Number? = null, nudgeY: Number? = null, labelPadding: Number? = null, labelR: Number? = null, labelSize: Number? = null, alphaStroke: Boolean? = null, sizeUnit: String? = null, colorBy: String? = null, fillBy: String? = null, mapping: LabelMapping.() -> Unit = {})

Parameters

data

The data to be displayed in this layer. If null, the default, the data is inherited from the plot data as specified in the call to letsPlot.

stat

The statistical transformation to use on the data for this layer. Supported transformations: Stat.identity, Stat.bin(), Stat.count(), etc. see Stat.

position

Position adjustment: positionIdentity, positionStack(), positionDodge(), etc. see Position.

showLegend

default = true. false - do not show legend for this layer.

manualKey

String or result of the call to the layerKey() function. The key to show in the manual legend. Specifies the text for the legend label or advanced settings using the layerKey() function.

sampling

Result of the call to the samplingXxx() function. To prevent any sampling for this layer pass value samplingNone. For more info see sampling.html.

tooltips

Result of the call to the layerTooltips() function. Specifies appearance, style and content.

map

Data-structure containing series of planar shapes and, optionally, associated data series (for example: names of States and their boundaries).

Supported shapes: Point and MultiPoint. All coordinates should be encoded as decimal degrees in WGS84 coordinate reference system.

Can be used with parameter mapJoin for joining data and map coordinates.

mapJoin

Pair of Names or Pair of Lists of Names. Specifies column names to join the data and the map coordinates on.

  • Pair.first: column name or list of column names in the data dataframe.

  • Pair.second: column name or list of column names in the map dataframe.

useCRS

By default, all coordinates are converted into degrees of longitude and latitude, and these map coordinates are projected onto the screen coordinates using Mercator projection. Specify useCRS = "provided" to keep the SpatialDataset's original coordinate reference system (CRS).

x

X-axis value.

y

Y-axis value.

label

Text to add to plot.

alpha

Transparency level of a layer. Understands numbers between 0 and 1.

color

Color of the geometry. For more info see: aesthetics.html#color-and-fill.

fill

Background color of the label. For more info see: aesthetics.html#color-and-fill.

size

Font size.

family

default = "sans". For more info see: aesthetics.html#font-family.

fontface

default = "plain". For more info see: aesthetics.html#font-face.

hjust

("left", "middle", "right") or number between 0 ("left") and 1 ("right") or "inward" (aligns label towards the plot center), "outward" (away from the plot center). Horizontal label alignment.

vjust

("bottom", "center", "top") or number between 0 ("bottom") and 1 ("top") or "inward" (aligns label towards the plot center), "outward" (away from the plot center). Vertical label alignment.

angle

Label rotation angle in degrees.

lineheight

Line height multiplier applied to the font size in the case of multi-line text.

labelFormat

Specifies the format pattern for displaying mapped values.

naText

default = "n/a". Text to show for missing values.

nudgeX

Horizontal adjustment to nudge labels by.

nudgeY

Vertical adjustment to nudge labels by.

labelPadding

Amount of padding around label. Defaults to 0.25 of font size.

labelR

Radius of rounded corners. Defaults to 0.15 of label height.

labelSize

default = 1.0. Size of label border.

alphaStroke

default = false. Enables the applying of 'alpha' to 'color' (label text and border).

sizeUnit

Relates the size of the text label to the length of the unit step along one of the axes. Possible values: "x", "y". If not specified, no fitting is performed.

colorBy

default = "color" ("fill", "color", "paint_a", "paint_b", "paint_c"). Defines the color aesthetic for the geometry.

fillBy

default = "fill" ("fill", "color", "paint_a", "paint_b", "paint_c"). Defines the fill aesthetic for the geometry.

mapping

Set of aesthetic mappings. Aesthetic mappings describe the way that variables in the data are mapped to plot "aesthetics".

Format patterns in the labelFormat parameter can be just a number format (like "d") or a string template where number format is surrounded by curly braces: "{d} cylinders". For more info see: formats.html Note: the "$" must be escaped as "\$".

Examples:

  • ".2f" -> "12.45"

  • "Score: {.2f}" -> "Score: 12.45"

  • "Score: {}" -> "Score: 12.454789"