facetWrap

fun facetWrap(facets: Any, ncol: Any? = null, nrow: Any? = null, scales: String? = null, order: Any? = 1, format: Any? = null, dir: String = "h", labWidth: Any? = null): OptionsMap

Splits data by one or more faceting variables. For each data subset creates a plot panel and lays out panels according to the ncol, nrow and dir settings.

Examples

Parameters

facets

One or more faceting variable names.

ncol

Number of columns.

nrow

Number of rows.

scales

Specifies whether scales are shared across all facets. default = "fixed" (shared) , "free" - vary across both rows and columns, "free_x" or "free_y" - vary across rows or columns respectively.

order

default = 1. Specifies ordering direction panels. 1 - ascending, -1 - descending, null - ascending. The order values are positionally matched to variables in facets.

format

Specifies the format pattern for displaying faceting values. The format values are positionally matched to variables in facets.

dir

Direction: either "h" for horizontal, the default, or "v", for vertical.

labWidth

Specifies the maximum label length (in characters) before a line break is applied. The labWidth values are positionally matched to variables in facets. If the original facet label already contains \n as a text separator, the line breaking is not applied.

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.md

Examples:

  • ".2f" -> "12.45";

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

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