Facet

smile.plot.vega.Facet
See theFacet companion object
trait Facet extends View

A facet is a trellis plot (or small multiple) of a series of similar plots that displays different subsets of the same data, facilitating comparison across subsets.

The facet channels (facet, row, and column) are encoding channels that serves as macros for a facet specification. Vega-Lite automatically translates this shortcut to use the facet operator.

Attributes

Companion
object
Graph
Supertypes
trait View
trait VegaLite
trait LazyLogging
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def column(field: String, `type`: String, bin: JsValue, timeUnit: String, align: String, center: Boolean, spacing: Int, header: JsValue, sort: JsValue): this.type

A field definition for the horizontal facet of trellis plots.

A field definition for the horizontal facet of trellis plots.

Attributes

def facet(field: String, `type`: String, bin: JsValue, timeUnit: String, align: String, center: Boolean, spacing: Int, columns: Int, header: JsValue, sort: JsValue): this.type

A field definition for the (flexible) facet of trellis plots. If either row or column is specified, this channel will be ignored.

A field definition for the (flexible) facet of trellis plots. If either row or column is specified, this channel will be ignored.

Value parameters

`type`

The encoded field's type of measurement ("quantitative", "temporal", "ordinal", or "nominal"). It can also be a "geojson" type for encoding 'geoshape'. Data type describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data. Data values for a temporal field can be either a date-time string (e.g., "2015-03-07 12:32:17", "17:01", "2015-03-16", "2015") or a timestamp number (e.g., 1552199579097).

align

The alignment to apply to row/column facet's subplot. The supported string values are "all", "each", and "none". - For "none", a flow layout will be used, in which adjacent subviews are simply placed one after the other. - For "each", subviews will be aligned into a clean grid structure, but each row or column may be of variable size. - For "all", subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.

bin

A flag for binning a quantitative field. - If true, default binning parameters will be applied. - If "binned", this indicates that the data for the x (or y) channel are already binned.

center

Boolean flag indicating if facet's subviews should be centered relative to their respective rows or columns.

columns

The number of columns to include in the view composition layout.

field

A string defining the name of the field from which to pull a data value or an object defining iterated values from the repeat operator.

header

An object defining properties of a facet's header.

sort

Sort order for the encoded field. For continuous fields (quantitative or temporal), sort can be either "ascending" or "descending". For discrete fields, sort can be one of the following: - "ascending" or "descending" - for sorting by the values' natural order in JavaScript. - A string indicating an encoding channel name to sort by (e.g., "x" or "y") with an optional minus prefix for descending sort (e.g., "-x" to sort by x-field, descending). This channel string is short-form of a sort-by-encoding definition. For example, "sort": "-x" is equivalent to "sort": {"encoding": "x", "order": "descending"}.

spacing

The spacing in pixels between facet's sub-views.

timeUnit

Time unit (e.g., year, yearmonth, month, hours) for a temporal field, or a temporal field that gets casted as ordinal.

Attributes

def row(field: String, `type`: String, bin: JsValue, timeUnit: String, align: String, center: Boolean, spacing: Int, header: JsValue, sort: JsValue): this.type

A field definition for the vertical facet of trellis plots.

A field definition for the vertical facet of trellis plots.

Attributes

Inherited methods

def angle(value: JsValue): View.this.type

Sets the angle value.

Sets the angle value.

Attributes

Inherited from:
View
def angle(field: JsValue, `type`: String, bin: JsValue, timeUnit: String, aggregate: String, scale: JsValue, legend: JsValue, condition: JsValue): View.this.type

Sets the angle property.

Sets the angle property.

Attributes

Inherited from:
View
def autosize(`type`: String, resize: Boolean, contains: String): VegaLite.this.type

Sets the overall size of the visualization. The total size of a Vega-Lite visualization may be determined by multiple factors: specified width, height, and padding values, as well as content such as axes, legends, and titles.

Sets the overall size of the visualization. The total size of a Vega-Lite visualization may be determined by multiple factors: specified width, height, and padding values, as well as content such as axes, legends, and titles.

Value parameters

`type`

The sizing format type. One of "pad", "fit", "fit-x", "fit-y", or "none". See the autosize type documentation for descriptions of each.

contains

Determines how size calculation should be performed, one of "content" or "padding". The default setting ("content") interprets the width and height settings as the data rectangle (plotting) dimensions, to which padding is then added. In contrast, the "padding" setting includes the padding within the view size calculations, such that the width and height settings indicate the total intended size of the view.

resize

A boolean flag indicating if autosize layout should be re-calculated on every view update.

Attributes

Inherited from:
VegaLite
def background(color: String): VegaLite.this.type

CSS color property to use as the background of the entire view.

CSS color property to use as the background of the entire view.

Attributes

Inherited from:
VegaLite
def color(value: JsValue): View.this.type

Sets the color value.

Sets the color value.

Attributes

Inherited from:
View
def color(field: JsValue, `type`: String, bin: JsValue, timeUnit: String, aggregate: String, scale: JsValue, legend: JsValue, condition: JsValue): View.this.type

Sets the color property.

Sets the color property.

Attributes

Inherited from:
View
def config(properties: JsObject): VegaLite.this.type

Sets Vega-Lite configuration object that lists configuration properties of a visualization for creating a consistent theme. This property can only be defined at the top-level of a specification.

Sets Vega-Lite configuration object that lists configuration properties of a visualization for creating a consistent theme. This property can only be defined at the top-level of a specification.

Attributes

Inherited from:
VegaLite
def data(url: String, format: JsValue): VegaLite.this.type

Sets the url of the data source.

Sets the url of the data source.

Value parameters

format

Type of input data: "json", "csv", "tsv", "dsv". Default value: The default format type is determined by the extension of the file URL. If no extension is detected, "json" will be used by default.

url

A URL from which to load the data set.

Attributes

Inherited from:
VegaLite
def data(df: DataFrame): VegaLite.this.type

Sets a data frame describing the data source.

Sets a data frame describing the data source.

Attributes

Inherited from:
VegaLite
def data(rows: JsObject*): VegaLite.this.type

Sets an array of objects describing the data source.

Sets an array of objects describing the data source.

Attributes

Inherited from:
VegaLite
def data(json: JsArray): VegaLite.this.type

Sets a JSON array describing the data source. Set to null to ignore the parent's data source. If no data is set, it is derived from the parent.

Sets a JSON array describing the data source. Set to null to ignore the parent's data source. If no data is set, it is derived from the parent.

Attributes

Inherited from:
VegaLite
def description(description: String): VegaLite.this.type

Sets the description of this mark for commenting purpose.

Sets the description of this mark for commenting purpose.

Attributes

Inherited from:
VegaLite
def encode(x: String, y: String, color: Option[(String, String)]): View.this.type

Sets the channels x and y (quantitative), and optional color with default properties.

Sets the channels x and y (quantitative), and optional color with default properties.

Attributes

Inherited from:
View
def fill(value: JsValue): View.this.type

Sets the fill value.

Sets the fill value.

Attributes

Inherited from:
View
def fill(field: JsValue, `type`: String, bin: JsValue, timeUnit: String, aggregate: String, scale: JsValue, legend: JsValue, condition: JsValue): View.this.type

Sets the fill property.

Sets the fill property.

Attributes

Inherited from:
View
def height(height: String): View.this.type

Sets the top-level height properties to "container" to indicate that the height of the plot should be the same as its surrounding container. The width and height can be set independently, for example, you can have a responsive width and a fixed height by setting width to "container" and height to a number.

Sets the top-level height properties to "container" to indicate that the height of the plot should be the same as its surrounding container. The width and height can be set independently, for example, you can have a responsive width and a fixed height by setting width to "container" and height to a number.

After setting width or height to "container", you need to ensure that the container's width or height is determined outside the plot. For example, the container can be a `

` element that has style width: 100%; height: 300px. When the container is not available or its size is not defined (e.g., in server-side rendering), the default width and height are config.view.continuousWidth and config.view.continuousHeight, respectively.

Attributes

Inherited from:
View
def height(height: Int): View.this.type

Sets the height of the data rectangle (plotting) dimensions.

Sets the height of the data rectangle (plotting) dimensions.

Attributes

Inherited from:
View
def heightStep(step: Int): View.this.type

For a discrete y-field, sets the height per discrete step..

For a discrete y-field, sets the height per discrete step..

Attributes

Inherited from:
View
def html: String

Returns the HTML of plot specification with Vega Embed.

Returns the HTML of plot specification with Vega Embed.

Attributes

Inherited from:
VegaLite
def iframe(id: String): String

Returns the HTML wrapped in an iframe to render in notebooks.

Returns the HTML wrapped in an iframe to render in notebooks.

Value parameters

id

the iframe HTML id.

Attributes

Inherited from:
VegaLite
def latitude(field: JsValue, `type`: String, bin: JsValue, timeUnit: String, aggregate: String, title: String): View.this.type

Sets the latitude field.

Sets the latitude field.

Attributes

Inherited from:
View
def latitude2(field: JsValue, bin: JsValue, timeUnit: String, aggregate: String, title: String): View.this.type

Sets the latitude2 field.

Sets the latitude2 field.

Attributes

Inherited from:
View
def longitude(field: JsValue, `type`: String, bin: JsValue, timeUnit: String, aggregate: String, title: String): View.this.type

Sets the longitude field.

Sets the longitude field.

Attributes

Inherited from:
View
def longitude2(field: JsValue, bin: JsValue, timeUnit: String, aggregate: String, title: String): View.this.type

Sets the longitude2 field.

Sets the longitude2 field.

Attributes

Inherited from:
View
def mark(mark: String): View.this.type

Sets the mark property of a string (one of "bar", "circle", "square", "tick", "line", "area", "point", "rule", "geoshape", and "text").

Sets the mark property of a string (one of "bar", "circle", "square", "tick", "line", "area", "point", "rule", "geoshape", and "text").

Attributes

Inherited from:
View
def mark(mark: JsObject): View.this.type

Sets the mark definition object. Marks are the basic visual building block of a visualization. They provide basic shapes whose properties (such as position, size, and color) can be used to visually encode data, either from a data field, or a constant value.

Sets the mark definition object. Marks are the basic visual building block of a visualization. They provide basic shapes whose properties (such as position, size, and color) can be used to visually encode data, either from a data field, or a constant value.

Attributes

Inherited from:
View
def name(name: String): VegaLite.this.type

Sets the name of the visualization for later reference.

Sets the name of the visualization for later reference.

Attributes

Inherited from:
VegaLite
def opacity(value: JsValue): View.this.type

Sets the opacity value.

Sets the opacity value.

Attributes

Inherited from:
View
def opacity(field: JsValue, `type`: String, bin: JsValue, timeUnit: String, aggregate: String, scale: JsValue, legend: JsValue, condition: JsValue): View.this.type

Sets the opacity property.

Sets the opacity property.

Attributes

Inherited from:
View
def padding(left: Int, top: Int, right: Int, bottom: Int): VegaLite.this.type

Specifies padding for each side. The visualization padding, in pixels, is from the edge of the visualization canvas to the data rectangle.

Specifies padding for each side. The visualization padding, in pixels, is from the edge of the visualization canvas to the data rectangle.

Attributes

Inherited from:
VegaLite
def padding(size: Int): VegaLite.this.type

Specifies padding for all sides. The visualization padding, in pixels, is from the edge of the visualization canvas to the data rectangle.

Specifies padding for all sides. The visualization padding, in pixels, is from the edge of the visualization canvas to the data rectangle.

Attributes

Inherited from:
VegaLite
def projection(projection: JsObject): View.this.type

Sets geographic projection, which will be applied to shape path for "geoshape" marks and to latitude and "longitude" channels for other marks.

Sets geographic projection, which will be applied to shape path for "geoshape" marks and to latitude and "longitude" channels for other marks.

A cartographic projection maps longitude and latitude pairs to x, y coordinates. As with Vega, one can use projections in Vega-Lite to layout both geographic points (such as locations on a map) represented by longitude and latitude coordinates, or to project geographic regions (such as countries and states) represented using the GeoJSON format. Projections are specified at the unit specification level, alongside encoding. Geographic coordinate data can then be mapped to longitude and latitude channels (and longitude2 and latitude2 for ranged marks).

Attributes

Inherited from:
View
def radius(field: JsValue, `type`: String, bin: JsValue, timeUnit: String, aggregate: String, title: String, scale: JsValue, sort: String, stack: JsValue): View.this.type

Sets the radius field.

Sets the radius field.

Attributes

Inherited from:
View
def radius2(field: JsValue, bin: JsValue, timeUnit: String, aggregate: String, title: String): View.this.type

Sets the radius2 field.

Sets the radius2 field.

Attributes

Inherited from:
View
def selection(selections: (String, String)*): View.this.type

Selections are the basic building block in Vega-Lite's grammar of interaction. They map user input (e.g., mouse moves and clicks, touch presses, etc.) into data queries, which can subsequently be used to drive conditional encoding rules, filter data points, or determine scale domains.

Selections are the basic building block in Vega-Lite's grammar of interaction. They map user input (e.g., mouse moves and clicks, touch presses, etc.) into data queries, which can subsequently be used to drive conditional encoding rules, filter data points, or determine scale domains.

The simplest definition of selection consists of a name and a type. The selection type determines the default events that trigger a selection and the resultant data query.

Vega-Lite currently supports three selection types:

  • "single" to select a single discrete data value on click.
  • "multi" to select multiple discrete data value; the first value is selected on click and additional values toggled on shift-click.
  • "interval" to select a continuous range of data values on drag.

Value parameters

selections

(name, type) pairs

Attributes

Inherited from:
View
def setProperty(prop: String, field: JsValue, `type`: String, bin: JsValue, timeUnit: String, aggregate: String, scale: JsValue, legend: JsValue, condition: JsValue): View.this.type

Sets a mark property.

Sets a mark property.

Attributes

Inherited from:
View
def setPropertyDatum(prop: String, datum: JsValue): View.this.type

Sets a mark property by datum.

Sets a mark property by datum.

Attributes

Inherited from:
View
def setPropertyValue(prop: String, value: JsValue): View.this.type

Sets a mark property by value.

Sets a mark property by value.

Attributes

Inherited from:
View
def shape(value: JsValue): View.this.type

Sets the shape value.

Sets the shape value.

Attributes

Inherited from:
View
def shape(field: JsValue, `type`: String, bin: JsValue, timeUnit: String, aggregate: String, scale: JsValue, legend: JsValue, condition: JsValue): View.this.type

Sets the shape property.

Sets the shape property.

Attributes

Inherited from:
View
def show(silent: Boolean): Unit

Displays the plot with the default browser.

Displays the plot with the default browser.

Value parameters

silent

If true, silently swallow any exception.

Attributes

Inherited from:
VegaLite
def size(value: JsValue): View.this.type

Sets the size value.

Sets the size value.

Attributes

Inherited from:
View
def size(field: JsValue, `type`: String, bin: JsValue, timeUnit: String, aggregate: String, scale: JsValue, legend: JsValue, condition: JsValue): View.this.type

Sets the size property.

Sets the size property.

Attributes

Inherited from:
View
def stroke(value: JsValue): View.this.type

Sets the stroke value.

Sets the stroke value.

Attributes

Inherited from:
View
def stroke(field: JsValue, `type`: String, bin: JsValue, timeUnit: String, aggregate: String, scale: JsValue, legend: JsValue, condition: JsValue): View.this.type

Sets the stroke property.

Sets the stroke property.

Attributes

Inherited from:
View
def text(value: JsValue): View.this.type

Sets the text value.

Sets the text value.

Attributes

Inherited from:
View
def text(field: JsValue, `type`: String, bin: JsValue, timeUnit: String, aggregate: String, scale: JsValue, legend: JsValue, condition: JsValue): View.this.type

Sets the text property.

Sets the text property.

Attributes

Inherited from:
View
def theta(field: JsValue, `type`: String, bin: JsValue, timeUnit: String, aggregate: String, title: String, scale: JsValue, sort: String, stack: JsValue): View.this.type

Sets the theta field.

Sets the theta field.

Attributes

Inherited from:
View
def theta2(field: JsValue, bin: JsValue, timeUnit: String, aggregate: String, title: String): View.this.type

Sets the theta2 field.

Sets the theta2 field.

Attributes

Inherited from:
View
def title(title: String): VegaLite.this.type

Sets a descriptive title to a chart.

Sets a descriptive title to a chart.

Attributes

Inherited from:
VegaLite
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
VegaLite -> Any
Inherited from:
VegaLite
def transform(transforms: JsObject*): VegaLite.this.type

An array of data transformations such as filter and new field calculation. Data transformations in Vega-Lite are described via either view-level transforms (the transform property) or field transforms inside encoding (bin, timeUnit, aggregate, sort, and stack).

An array of data transformations such as filter and new field calculation. Data transformations in Vega-Lite are described via either view-level transforms (the transform property) or field transforms inside encoding (bin, timeUnit, aggregate, sort, and stack).

When both types of transforms are specified, the view-level transforms are executed first based on the order in the array. Then the inline transforms are executed in this order: bin, timeUnit, aggregate, sort, and stack.

Attributes

Inherited from:
VegaLite
def transform(transforms: JsArray): VegaLite.this.type

An array of data transformations such as filter and new field calculation. Data transformations in Vega-Lite are described via either view-level transforms (the transform property) or field transforms inside encoding (bin, timeUnit, aggregate, sort, and stack).

An array of data transformations such as filter and new field calculation. Data transformations in Vega-Lite are described via either view-level transforms (the transform property) or field transforms inside encoding (bin, timeUnit, aggregate, sort, and stack).

When both types of transforms are specified, the view-level transforms are executed first based on the order in the array. Then the inline transforms are executed in this order: bin, timeUnit, aggregate, sort, and stack.

Attributes

Inherited from:
VegaLite
def usermeta(data: JsValue): VegaLite.this.type

Optional metadata that will be passed to Vega. This object is completely ignored by Vega and Vega-Lite and can be used for custom metadata.

Optional metadata that will be passed to Vega. This object is completely ignored by Vega and Vega-Lite and can be used for custom metadata.

Attributes

Inherited from:
VegaLite
def view(background: JsObject): View.this.type

Sets the view background's fill and stroke. The background property of a top-level view specification defines the background of the whole visualization canvas. Meanwhile, the view property of a single-view or layer specification can define the background of the view.

Sets the view background's fill and stroke. The background property of a top-level view specification defines the background of the whole visualization canvas. Meanwhile, the view property of a single-view or layer specification can define the background of the view.

Attributes

Inherited from:
View
def width(width: String): View.this.type

Sets the top-level width properties to "container" to indicate that the width of the plot should be the same as its surrounding container. The width and height can be set independently, for example, you can have a responsive width and a fixed height by setting width to "container" and height to a number.

Sets the top-level width properties to "container" to indicate that the width of the plot should be the same as its surrounding container. The width and height can be set independently, for example, you can have a responsive width and a fixed height by setting width to "container" and height to a number.

After setting width or height to "container", you need to ensure that the container's width or height is determined outside the plot. For example, the container can be a `

` element that has style width: 100%; height: 300px. When the container is not available or its size is not defined (e.g., in server-side rendering), the default width and height are config.view.continuousWidth and config.view.continuousHeight, respectively.

Attributes

Inherited from:
View
def width(width: Int): View.this.type

Sets the width of the data rectangle (plotting) dimensions.

Sets the width of the data rectangle (plotting) dimensions.

Attributes

Inherited from:
View
def widthStep(step: Int): View.this.type

For a discrete x-field, sets the width per discrete step.

For a discrete x-field, sets the width per discrete step.

Attributes

Inherited from:
View
def x(field: JsValue, `type`: String, bin: JsValue, timeUnit: String, aggregate: String, title: String, scale: JsValue, axis: JsValue, sort: JsValue, band: Double, impute: JsValue, stack: JsValue): View.this.type

Sets the x field.

Sets the x field.

Attributes

Inherited from:
View
def x(datum: JsValue): View.this.type

Sets the x channel as a datum field.

Sets the x channel as a datum field.

Attributes

Inherited from:
View
def x2(field: JsValue, bin: JsValue, timeUnit: String, aggregate: String, title: String): View.this.type

Sets the x2 field.

Sets the x2 field.

Attributes

Inherited from:
View
def xError(field: JsValue, bin: JsValue, timeUnit: String, aggregate: String, title: String): View.this.type

Sets the xError field.

Sets the xError field.

Attributes

Inherited from:
View
def xError2(field: JsValue, bin: JsValue, timeUnit: String, aggregate: String, title: String): View.this.type

Sets the xError2 field.

Sets the xError2 field.

Attributes

Inherited from:
View
def y(field: JsValue, `type`: String, bin: JsValue, timeUnit: String, aggregate: String, title: String, scale: JsValue, axis: JsValue, sort: JsValue, band: Double, impute: JsValue, stack: JsValue): View.this.type

Sets the y field.

Sets the y field.

Attributes

Inherited from:
View
def y(datum: JsValue): View.this.type

Sets the y channel as a datum field.

Sets the y channel as a datum field.

Attributes

Inherited from:
View
def y2(field: JsValue, bin: JsValue, timeUnit: String, aggregate: String, title: String): View.this.type

Sets the y2 field.

Sets the y2 field.

Attributes

Inherited from:
View
def yError(field: JsValue, bin: JsValue, timeUnit: String, aggregate: String, title: String): View.this.type

Sets the yError field.

Sets the yError field.

Attributes

Inherited from:
View
def yError2(field: JsValue, bin: JsValue, timeUnit: String, aggregate: String, title: String): View.this.type

Sets the yError2 field.

Sets the yError2 field.

Attributes

Inherited from:
View

Inherited fields

lazy protected val logger: Logger

Attributes

Inherited from:
LazyLogging
val spec: JsObject

The specification

The specification

Attributes

Inherited from:
VegaLite