plot-api / jetbrains.letsPlot.geom / geom_text

geom_text

class geom_text : TextAesthetics, TextParameters, WithSizeUnitOption, WithSpatialParameters, LayerBase

Add a text directly to the plot.

Parameters

data - dictionary or pandas DataFrame, optional. The data to be displayed in this layer. If None, the default, the data is inherited from the plot data as specified in the call to lets_plot.

stat - string, optional. The statistical transformation to use on the data for this layer, as a string. Supported transformations: "identity" (leaves the data unchanged), "count" (counts number of points with same x-axis coordinate), "bin" (counts number of points with x-axis coordinate in the same bin), "smooth" (performs smoothing - linear default)

position - string, optional. Position adjustment, either as a string ("identity", "stack", "dodge", ...), or the result of a call to a position adjustment function.

tooltips - result of the call to the layer_tooltips() function. Specifies appearance, style and content.

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

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.

x - x-axis value.

y - y-axis value.

label - text to add to plot.

alpha - transparency level of a point Understands numbers between 0 and 1.

color - (colour) color of a geometry. Can be continuous or discrete. For continuous value this will be a color gradient between two colors.

size - font size.

family - ('sans' | 'serif' | 'mono' | any other like: "Times New Roman") Font family. The default is 'sans'

fontface - ('plain' | 'bold' | 'italic' | 'bold italic') Font style and weight. The default is 'plain'

hjust - ('left', 'middle', 'right') or number between 0 ('right') and 1 ('left'). Horizontal text alignment.

vjust - ('bottom', 'center', 'top') or number between 0 ('bottom') and 1 ('top'). Vertical text alignment.

angle - text rotation angle in degrees.

labelFormat - string. Specifies the format pattern for displaying mapped values.

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: https://github.com/JetBrains/lets-plot-kotlin/blob/master/docs/formats.md Note: the "$" must be escaped as "\$"

Examples: ".2f" -> "12.45" "Score: {.2f}" -> "Score: 12.45" "Score: {}" -> "Score: 12.454789"

Constructors

<init>

Add a text directly to the plot.

geom_text(data: Map<*, *>? = null, stat: StatOptions = Stat.identity, position: PosOptions = identity, showLegend: Boolean = true, sampling: SamplingOptions? = null, tooltips: TooltipOptions? = null, map: SpatialDataset? = null, mapJoin: Pair<Any, Any>? = null, x: Number? = null, y: Number? = null, label: String? = null, alpha: Number? = null, color: Any? = null, size: Number? = null, family: String? = null, fontface: String? = null, hjust: Any? = null, vjust: Any? = null, angle: Number? = null, labelFormat: String? = null, naText: String? = null, sizeUnit: String? = null, mapping: TextMapping.() -> Unit = {})

Properties

alpha

transparency level of a point Understands numbers between 0 and 1.

val alpha: Number?

angle

text rotation angle in degrees.

val angle: Number?

color

(colour) color of a geometry. Can be continuous or discrete. For continuous value this will be a color gradient between two colors.

val color: Any?

family

('sans' | 'serif' | 'mono' | any other like: "Times New Roman") Font family. The default is 'sans'

val family: String?

fontface

('plain' | 'bold' | 'italic' | 'bold italic') Font style and weight. The default is 'plain'

val fontface: String?

hjust

('left', 'middle', 'right') or number between 0 ('right') and 1 ('left'). Horizontal text alignment.

val hjust: Any?

label

text to add to plot.

val label: String?

labelFormat

string. Specifies the format pattern for displaying mapped values.

val labelFormat: String?

map

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

val map: SpatialDataset?

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.

val mapJoin: Pair<Any, Any>?

naText

val naText: String?

size

font size.

val size: Number?

sizeUnit

val sizeUnit: String?

vjust

('bottom', 'center', 'top') or number between 0 ('bottom') and 1 ('top'). Vertical text alignment.

val vjust: Any?

x

x-axis value.

val x: Number?

y

y-axis value.

val y: Number?

Functions

seal

fun seal(): Options

Extension Functions

toSpec

fun Layer.toSpec(): MutableMap<String, Any>