scaleYDiscrete

fun scaleYDiscrete(name: String? = null, breaks: Any? = null, labels: Any? = null, lablim: Int? = null, limits: List<Any>? = null, expand: List<Number>? = null, naValue: Number? = null, format: String? = null, reverse: Boolean? = null, position: String? = null): Scale

Discrete scale for y-axis.

Parameters

name

The name of the scale - used as the axis label or the legend title. If null, the default, the name of the scale is taken from the first mapping used for that aesthetic.

breaks

A list of data values specifying the positions of ticks, or a dictionary which maps the tick labels to the breaks values.

labels

A list of labels on ticks, or a dictionary which maps the breaks values to the tick labels.

lablim

The maximum label length (in characters) before trimming is applied.

limits

A vector specifying values to display on the axis and their order. Setting limits will remove data not included in the list.

expand

A numeric vector of length two giving multiplicative and additive expansion constants. The vector size == 1 => only multiplicative expand (and additive expand by default). Defaults: multiplicative = 0, additive = 0.2.

naValue

Missing values will be replaced with this value.

format

Specifies the format pattern for labels on the scale.

reverse

When true the scale reversed.

position

The position of the axis:

  • "left", "right" or "both" for y-axis;

  • "top", "bottom" or "both" for x-axis.

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

Examples:

  • ".2f" -> "12.45"

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

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