API Reference¶
Top-Level Objects¶
-
class
altair.
Chart
(data=Undefined, encoding=Undefined, mark=Undefined, width=Undefined, height=Undefined, **kwargs)¶ Create a basic Altair/Vega-Lite chart.
Although it is possible to set all Chart properties as constructor attributes, it is more idiomatic to use methods such as
mark_point()
,encode()
,transform_filter()
,properties()
, etc. See Altair’s documentation for details and examples: http://altair-viz.github.io/.Attributes: - data : Data
An object describing the data source
- mark : AnyMark
- A string describing the mark type (one of “bar”, “circle”, “square”, “tick”,
“line”, * “area”, “point”, “rule”, “geoshape”, and “text”) or a MarkDef object.
- encoding : EncodingWithFacet
A key-value mapping between encoding channels and definition of fields.
- autosize : anyOf(AutosizeType, AutoSizeParams)
Sets how the visualization size should be determined. If a string, should be one of “pad”, “fit” or “none”. Object values can additionally specify parameters for content sizing and automatic resizing. “fit” is only supported for single and layered views that don’t use rangeStep. __Default value__: pad
- background : string
CSS color property to use as the background of visualization.
Default value: none (transparent)
- config : Config
Vega-Lite configuration object. This property can only be defined at the top-level of a specification.
- description : string
Description of this mark for commenting purpose.
- height : float
The height of a visualization.
- name : string
Name of the visualization for later reference.
- padding : Padding
The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format {“left”: 5, “top”: 5, “right”: 5, “bottom”: 5} to specify padding for each side of the visualization. __Default value__: 5
- projection : Projection
An object defining properties of geographic projection. Works with “geoshape” marks and “point” or “line” marks that have a channel (one or more of “X”, “X2”, “Y”, “Y2”) with type “latitude”, or “longitude”.
- selection : Mapping(required=[])
A key-value mapping between selection names and definitions.
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- width : float
The width of a visualization.
-
facet
(row=Undefined, column=Undefined, data=Undefined, **kwargs)¶ Create a facet chart from the current chart.
Faceted charts require data to be specified at the top level; if data is not specified, the data from the current chart will be used at the top level.
-
classmethod
from_dict
(dct, validate=True)¶ Construct class from a dictionary representation
Parameters: - dct : dictionary
The dict from which to construct the class
- validate : boolean
If True (default), then validate the input against the schema.
- _wrapper_classes : list (optional)
The set of SchemaBase classes to use when constructing wrappers of the dict inputs. If not specified, the result of cls._default_wrapper_classes will be used.
Returns: - obj : Schema object
The wrapped schema
Raises: - jsonschema.ValidationError :
if validate=True and dct does not conform to the schema
-
interactive
(name=None, bind_x=True, bind_y=True)¶ Make chart axes scales interactive
Parameters: - name : string
The selection name to use for the axes scales. This name should be unique among all selections within the chart.
- bind_x : boolean, default True
If true, then bind the interactive scales to the x-axis
- bind_y : boolean, default True
If true, then bind the interactive scales to the y-axis
Returns: - chart :
copy of self, with interactive axes added
-
class
altair.
LayerChart
(data=Undefined, layer=(), **kwargs)¶ A Chart with layers within a single panel Mapping(required=[layer])
Attributes: - layer : List(anyOf(LayerSpec, CompositeUnitSpec))
Layer or single view specifications to be layered.
Note : Specifications inside
layer
cannot userow
andcolumn
channels as layering facet specifications is not allowed.- autosize : anyOf(AutosizeType, AutoSizeParams)
Sets how the visualization size should be determined. If a string, should be one of
"pad"
,"fit"
or"none"
. Object values can additionally specify parameters for content sizing and automatic resizing."fit"
is only supported for single and layered views that don’t userangeStep
.Default value :
pad
- background : string
CSS color property to use as the background of visualization.
Default value: none (transparent)
- config : Config
Vega-Lite configuration object. This property can only be defined at the top-level of a specification.
- data : Data
An object describing the data source
- datasets : Datasets
A global data store for named datasets. This is a mapping from names to inline datasets. This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a
data
property.- description : string
Description of this mark for commenting purpose.
- encoding : Encoding
A shared key-value mapping between encoding channels and definition of fields in the underlying layers.
- height : float
The height of a visualization.
Default value:
- If a view’s autosize
type is
"fit"
or its y-channel has a continuous scale, the height will be the value of config.view.height. - For y-axis with a band or point scale: if rangeStep is a numeric value or
unspecified, the height is determined by the range step, paddings, and the
cardinality of the field mapped to y-channel. Otherwise, if the
rangeStep
isnull
, the height will be the value of config.view.height. - If no field is mapped to
y
channel, theheight
will be the value ofrangeStep
.
Note : For plots with row and column channels, this represents the height of a single view.
See also: The documentation for width and height contains more examples.
- If a view’s autosize
type is
- name : string
Name of the visualization for later reference.
- padding : Padding
The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format
{"left": 5, "top": 5, "right": 5, "bottom": 5}
to specify padding for each side of the visualization.Default value :
5
- projection : Projection
An object defining properties of the geographic projection shared by underlying layers.
- resolve : Resolve
Scale, axis, and legend resolutions for layers.
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- width : float
The width of a visualization.
Default value: This will be determined by the following rules:
- If a view’s autosize
type is
"fit"
or its x-channel has a continuous scale, the width will be the value of config.view.width. - For x-axis with a band or point scale: if rangeStep is a numeric value or
unspecified, the width is determined by the range step, paddings, and the
cardinality of the field mapped to x-channel. Otherwise, if the
rangeStep
isnull
, the width will be the value of config.view.width. - If no field is mapped to
x
channel, thewidth
will be the value of config.scale.textXRangeStep fortext
mark and the value ofrangeStep
for other marks.
Note: For plots with row and column channels, this represents the width of a single view.
See also: The documentation for width and height contains more examples.
- If a view’s autosize
type is
- $schema : string
URL to JSON schema for a Vega-Lite specification. Unless you have a reason to change this, use
https://vega.github.io/schema/vega-lite/v2.json
. Setting the$schema
property allows automatic validation and autocomplete in editors that support JSON schema.
-
facet
(row=Undefined, column=Undefined, data=Undefined, **kwargs)¶ Create a facet chart from the current chart.
Faceted charts require data to be specified at the top level; if data is not specified, the data from the current chart will be used at the top level.
-
interactive
(name=None, bind_x=True, bind_y=True)¶ Make chart axes scales interactive
Parameters: - name : string
The selection name to use for the axes scales. This name should be unique among all selections within the chart.
- bind_x : boolean, default True
If true, then bind the interactive scales to the x-axis
- bind_y : boolean, default True
If true, then bind the interactive scales to the y-axis
Returns: - chart :
copy of self, with interactive axes added
-
class
altair.
HConcatChart
(data=Undefined, hconcat=(), **kwargs)¶ - A chart with horizontally-concatenated facets
- Mapping(required=[hconcat])
Attributes: - hconcat : List(Spec)
A list of views that should be concatenated and put into a row.
- autosize : anyOf(AutosizeType, AutoSizeParams)
Sets how the visualization size should be determined. If a string, should be one of
"pad"
,"fit"
or"none"
. Object values can additionally specify parameters for content sizing and automatic resizing."fit"
is only supported for single and layered views that don’t userangeStep
.Default value :
pad
background : string
- <<<<<<< HEAD
CSS color property to use as the background of visualization.
Default value: none (transparent)
- =======
CSS color property to use as the background of visualization. Default value: none (transparent)
- bounds : enum(‘full’, ‘flush’)
The bounds calculation method to use for determining the extent of a sub-plot. One of
full
(the default) orflush
. * If set tofull
, the entire calculated bounds (including axes, title, and legend) will be used. * If set toflush
, only the specified width and height values for the sub-view will be used.The
flush
setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. Default value:"full"
- center : boolean
Boolean flag indicating if subviews should be centered relative to their respective rows or columns. Default value:
false
- >>>>>>> altair-viz/master
- config : Config
Vega-Lite configuration object. This property can only be defined at the top-level of a specification.
- data : Data
An object describing the data source
- datasets : Datasets
A global data store for named datasets. This is a mapping from names to inline datasets. This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a
data
property.- description : string
Description of this mark for commenting purpose.
- name : string
Name of the visualization for later reference.
- padding : Padding
The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format
{"left": 5, "top": 5, "right": 5, "bottom": 5}
to specify padding for each side of the visualization.Default value :
5
- resolve : Resolve
Scale, axis, and legend resolutions for horizontally concatenated charts.
- spacing : float
- The spacing in pixels between sub-views of the concat operator. Default value :
10
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- $schema : string
URL to JSON schema for a Vega-Lite specification. Unless you have a reason to change this, use
https://vega.github.io/schema/vega-lite/v2.json
. Setting the$schema
property allows automatic validation and autocomplete in editors that support JSON schema.
-
class
altair.
VConcatChart
(data=Undefined, vconcat=(), **kwargs)¶ - A chart with vertically-concatenated facets
- Mapping(required=[vconcat])
Attributes: - vconcat : List(Spec)
A list of views that should be concatenated and put into a column.
- autosize : anyOf(AutosizeType, AutoSizeParams)
Sets how the visualization size should be determined. If a string, should be one of
"pad"
,"fit"
or"none"
. Object values can additionally specify parameters for content sizing and automatic resizing."fit"
is only supported for single and layered views that don’t userangeStep
.Default value :
pad
background : string
- <<<<<<< HEAD
CSS color property to use as the background of visualization.
Default value: none (transparent)
- =======
CSS color property to use as the background of visualization. Default value: none (transparent)
- bounds : enum(‘full’, ‘flush’)
The bounds calculation method to use for determining the extent of a sub-plot. One of
full
(the default) orflush
. * If set tofull
, the entire calculated bounds (including axes, title, and legend) will be used. * If set toflush
, only the specified width and height values for the sub-view will be used.The
flush
setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. Default value:"full"
- center : boolean
Boolean flag indicating if subviews should be centered relative to their respective rows or columns. Default value:
false
- >>>>>>> altair-viz/master
- config : Config
Vega-Lite configuration object. This property can only be defined at the top-level of a specification.
- data : Data
An object describing the data source
- datasets : Datasets
A global data store for named datasets. This is a mapping from names to inline datasets. This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a
data
property.- description : string
Description of this mark for commenting purpose.
- name : string
Name of the visualization for later reference.
- padding : Padding
The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format
{"left": 5, "top": 5, "right": 5, "bottom": 5}
to specify padding for each side of the visualization.Default value :
5
- resolve : Resolve
Scale, axis, and legend resolutions for vertically concatenated charts.
- spacing : float
- The spacing in pixels between sub-views of the concat operator. Default value :
10
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- $schema : string
URL to JSON schema for a Vega-Lite specification. Unless you have a reason to change this, use
https://vega.github.io/schema/vega-lite/v2.json
. Setting the$schema
property allows automatic validation and autocomplete in editors that support JSON schema.
-
class
altair.
FacetChart
(data=Undefined, spec=Undefined, facet=Undefined, **kwargs)¶ - A Chart with layers within a single panel
- Mapping(required=[data, facet, spec])
Attributes: - data : Data
An object describing the data source
- facet : FacetMapping
An object that describes mappings between
row
andcolumn
channels and their field definitions.- spec : anyOf(LayerSpec, CompositeUnitSpec)
A specification of the view that gets faceted.
- align : anyOf(VgLayoutAlign, RowColVgLayoutAlign)
The alignment to apply to grid rows and columns. 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. Alternatively, an object value of the form{"row": string, "column": string}
canbe used to supply different alignments for rows and columns. Default value:
"all"
.- autosize : anyOf(AutosizeType, AutoSizeParams)
Sets how the visualization size should be determined. If a string, should be one of
"pad"
,"fit"
or"none"
. Object values can additionally specify parameters for content sizing and automatic resizing."fit"
is only supported for single and layered views that don’t userangeStep
.Default value :
pad
background : string
- <<<<<<< HEAD
CSS color property to use as the background of visualization.
Default value: none (transparent)
- =======
CSS color property to use as the background of visualization. Default value: none (transparent)
- bounds : enum(‘full’, ‘flush’)
The bounds calculation method to use for determining the extent of a sub-plot. One of
full
(the default) orflush
. * If set tofull
, the entire calculated bounds (including axes, title, and legend) will be used. * If set toflush
, only the specified width and height values for the sub-view will be used.The
flush
setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. Default value:"full"
- center : anyOf(boolean, RowColboolean)
Boolean flag indicating if subviews should be centered relative to their respective rows or columns. An object value of the form
{"row": boolean, "column": boolean}
can be used to supply different centering values for rows and columns. Default value:false
- >>>>>>> altair-viz/master
- config : Config
Vega-Lite configuration object. This property can only be defined at the top-level of a specification.
- datasets : Datasets
A global data store for named datasets. This is a mapping from names to inline datasets. This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a
data
property.- description : string
Description of this mark for commenting purpose.
- name : string
Name of the visualization for later reference.
- padding : Padding
The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format
{"left": 5, "top": 5, "right": 5, "bottom": 5}
to specify padding for each side of the visualization.Default value :
5
- resolve : Resolve
Scale, axis, and legend resolutions for facets.
- spacing : anyOf(float, RowColnumber)
The spacing in pixels between sub-views of the composition operator. An object of the form
{"row": number, "column": number}
can be used to set different spacing values for rows and columns. Default value :10
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- $schema : string
URL to JSON schema for a Vega-Lite specification. Unless you have a reason to change this, use
https://vega.github.io/schema/vega-lite/v2.json
. Setting the$schema
property allows automatic validation and autocomplete in editors that support JSON schema.
-
interactive
(name=None, bind_x=True, bind_y=True)¶ Make chart axes scales interactive
Parameters: - name : string
The selection name to use for the axes scales. This name should be unique among all selections within the chart.
- bind_x : boolean, default True
If true, then bind the interactive scales to the x-axis
- bind_y : boolean, default True
If true, then bind the interactive scales to the y-axis
Returns: - chart :
copy of self, with interactive axes added
-
class
altair.
RepeatChart
(data=Undefined, spec=Undefined, repeat=Undefined, **kwargs)¶ - A chart repeated across rows and columns with small changes
- Mapping(required=[repeat, spec])
Attributes: repeat
: RepeatReturn a RepeatChart built from the chart
- <<<<<<< HEAD
CSS color property to use as the background of visualization.
Default value: none (transparent)
- =======
CSS color property to use as the background of visualization. Default value: none (transparent)
- bounds : enum(‘full’, ‘flush’)
The bounds calculation method to use for determining the extent of a sub-plot. One of
full
(the default) orflush
. * If set tofull
, the entire calculated bounds (including axes, title, and legend) will be used. * If set toflush
, only the specified width and height values for the sub-view will be used.The
flush
setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. Default value:"full"
- center : anyOf(boolean, RowColboolean)
Boolean flag indicating if subviews should be centered relative to their respective rows or columns. An object value of the form
{"row": boolean, "column": boolean}
can be used to supply different centering values for rows and columns. Default value:false
- >>>>>>> altair-viz/master
- config : Config
Vega-Lite configuration object. This property can only be defined at the top-level of a specification.
- data : Data
An object describing the data source
- datasets : Datasets
A global data store for named datasets. This is a mapping from names to inline datasets. This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a
data
property.- description : string
Description of this mark for commenting purpose.
- name : string
Name of the visualization for later reference.
- padding : Padding
The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format
{"left": 5, "top": 5, "right": 5, "bottom": 5}
to specify padding for each side of the visualization.Default value :
5
- resolve : Resolve
Scale and legend resolutions for repeated charts.
- spacing : anyOf(float, RowColnumber)
The spacing in pixels between sub-views of the composition operator. An object of the form
{"row": number, "column": number}
can be used to set different spacing values for rows and columns. Default value :10
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- $schema : string
URL to JSON schema for a Vega-Lite specification. Unless you have a reason to change this, use
https://vega.github.io/schema/vega-lite/v2.json
. Setting the$schema
property allows automatic validation and autocomplete in editors that support JSON schema.
-
interactive
(name=None, bind_x=True, bind_y=True)¶ Make chart axes scales interactive
Parameters: - name : string
The selection name to use for the axes scales. This name should be unique among all selections within the chart.
- bind_x : boolean, default True
If true, then bind the interactive scales to the x-axis
- bind_y : boolean, default True
If true, then bind the interactive scales to the y-axis
Returns: - chart :
copy of self, with interactive axes added
Encoding Channels¶
-
class
altair.
Color
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Color schema wrapper
Mapping(required=[shorthand]) A FieldDef with Condition
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- legend : anyOf(Legend, None)
An object defining properties of the legend. If
null
, the legend for the encoding channel will be removed.Default value: If undefined, default legend properties are applied.
- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
ColorValue
(value, condition=Undefined, **kwds)¶ ColorValue schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalMarkPropFieldDef, ConditionalValueDef,
- List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
Column
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, header=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Column schema wrapper
Mapping(required=[shorthand])
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- header : Header
An object defining properties of a facet’s header.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
Detail
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Detail schema wrapper
Mapping(required=[shorthand]) Definition object for a data field, its type and transformation of an encoding channel.
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
Href
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Href schema wrapper
Mapping(required=[shorthand]) A FieldDef with Condition
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
HrefValue
(value, condition=Undefined, **kwds)¶ HrefValue schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalFieldDef, ConditionalValueDef, List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
Opacity
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Opacity schema wrapper
Mapping(required=[shorthand]) A FieldDef with Condition
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- legend : anyOf(Legend, None)
An object defining properties of the legend. If
null
, the legend for the encoding channel will be removed.Default value: If undefined, default legend properties are applied.
- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
OpacityValue
(value, condition=Undefined, **kwds)¶ OpacityValue schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalMarkPropFieldDef, ConditionalValueDef,
- List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
Order
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Order schema wrapper
Mapping(required=[shorthand])
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- sort : SortOrder
The sort order. One of
"ascending"
(default) or"descending"
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
Row
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, header=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Row schema wrapper
Mapping(required=[shorthand])
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- header : Header
An object defining properties of a facet’s header.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
Shape
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Shape schema wrapper
Mapping(required=[shorthand]) A FieldDef with Condition
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- legend : anyOf(Legend, None)
An object defining properties of the legend. If
null
, the legend for the encoding channel will be removed.Default value: If undefined, default legend properties are applied.
- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
ShapeValue
(value, condition=Undefined, **kwds)¶ ShapeValue schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalMarkPropFieldDef, ConditionalValueDef,
- List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
Size
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Size schema wrapper
Mapping(required=[shorthand]) A FieldDef with Condition
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- legend : anyOf(Legend, None)
An object defining properties of the legend. If
null
, the legend for the encoding channel will be removed.Default value: If undefined, default legend properties are applied.
- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
SizeValue
(value, condition=Undefined, **kwds)¶ SizeValue schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalMarkPropFieldDef, ConditionalValueDef,
- List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
Text
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, format=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Text schema wrapper
Mapping(required=[shorthand]) A FieldDef with Condition
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- format : string
The formatting pattern for a text field. If not defined, this will be determined automatically.
- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
TextValue
(value, condition=Undefined, **kwds)¶ TextValue schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalTextFieldDef, ConditionalValueDef, List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
Tooltip
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, format=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Tooltip schema wrapper
Mapping(required=[shorthand]) A FieldDef with Condition
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- format : string
The formatting pattern for a text field. If not defined, this will be determined automatically.
- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
TooltipValue
(value, condition=Undefined, **kwds)¶ TooltipValue schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalTextFieldDef, ConditionalValueDef, List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
X
(shorthand=Undefined, aggregate=Undefined, axis=Undefined, bin=Undefined, field=Undefined, scale=Undefined, sort=Undefined, stack=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ X schema wrapper
Mapping(required=[shorthand])
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- axis : anyOf(Axis, None)
An object defining properties of axis’s gridlines, ticks and labels. If
null
, the axis for the encoding channel will be removed.Default value: If undefined, default axis properties are applied.
- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- stack : anyOf(StackOffset, None)
Type of stacking offset if the field should be stacked.
stack
is only applicable forx
andy
channels with continuous domains. For example,stack
ofy
can be used to customize stacking for a vertical bar chart.stack
can be one of the following values:- “zero”: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and area chart).
"normalize"
- stacking with normalized domain (for creating normalized stacked bar and area charts.
"center"
- stacking with center baseline (for `streamgraph
<https://vega.github.io/vega-lite/docs/stack.html#streamgraph>`_ ). *
null
- No-stacking. This will produce layered `bar<https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart>`_ and area chart.
Default value:
zero
for plots with all of the following conditions are true: (1) the mark isbar
orarea
; (2) the stacked measure channel (x or y) has a linear scale; (3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise,null
by default.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
XValue
(value, **kwds)¶ XValue schema wrapper
Mapping(required=[value]) Definition object for a constant value of an encoding channel.
Attributes: - value : anyOf(float, string, boolean)
A constant value in visual domain (e.g.,
"red"
/ “#0099ff” for color, values between0
to1
for opacity).
-
class
altair.
X2
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ X2 schema wrapper
Mapping(required=[shorthand]) Definition object for a data field, its type and transformation of an encoding channel.
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
X2Value
(value, **kwds)¶ X2Value schema wrapper
Mapping(required=[value]) Definition object for a constant value of an encoding channel.
Attributes: - value : anyOf(float, string, boolean)
A constant value in visual domain (e.g.,
"red"
/ “#0099ff” for color, values between0
to1
for opacity).
-
class
altair.
Y
(shorthand=Undefined, aggregate=Undefined, axis=Undefined, bin=Undefined, field=Undefined, scale=Undefined, sort=Undefined, stack=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Y schema wrapper
Mapping(required=[shorthand])
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- axis : anyOf(Axis, None)
An object defining properties of axis’s gridlines, ticks and labels. If
null
, the axis for the encoding channel will be removed.Default value: If undefined, default axis properties are applied.
- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- stack : anyOf(StackOffset, None)
Type of stacking offset if the field should be stacked.
stack
is only applicable forx
andy
channels with continuous domains. For example,stack
ofy
can be used to customize stacking for a vertical bar chart.stack
can be one of the following values:- “zero”: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and area chart).
"normalize"
- stacking with normalized domain (for creating normalized stacked bar and area charts.
"center"
- stacking with center baseline (for `streamgraph
<https://vega.github.io/vega-lite/docs/stack.html#streamgraph>`_ ). *
null
- No-stacking. This will produce layered `bar<https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart>`_ and area chart.
Default value:
zero
for plots with all of the following conditions are true: (1) the mark isbar
orarea
; (2) the stacked measure channel (x or y) has a linear scale; (3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise,null
by default.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
YValue
(value, **kwds)¶ YValue schema wrapper
Mapping(required=[value]) Definition object for a constant value of an encoding channel.
Attributes: - value : anyOf(float, string, boolean)
A constant value in visual domain (e.g.,
"red"
/ “#0099ff” for color, values between0
to1
for opacity).
-
class
altair.
Y2
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Y2 schema wrapper
Mapping(required=[shorthand]) Definition object for a data field, its type and transformation of an encoding channel.
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
Y2Value
(value, **kwds)¶ Y2Value schema wrapper
Mapping(required=[value]) Definition object for a constant value of an encoding channel.
Attributes: - value : anyOf(float, string, boolean)
A constant value in visual domain (e.g.,
"red"
/ “#0099ff” for color, values between0
to1
for opacity).
Other Objects¶
-
exception
altair.
MaxRowsError
¶ Raised when a data model has too many rows.
-
class
altair.
Aggregate
(*args)¶ Aggregate schema wrapper
enum(‘argmax’, ‘argmin’, ‘average’, ‘count’, ‘distinct’, ‘max’, ‘mean’, ‘median’, ‘min’, ‘missing’, ‘q1’, ‘q3’, ‘ci0’, ‘ci1’, ‘stderr’, ‘stdev’, ‘stdevp’, ‘sum’, ‘valid’, ‘values’, ‘variance’, ‘variancep’)
-
class
altair.
AggregateOp
(*args)¶ AggregateOp schema wrapper
enum(‘argmax’, ‘argmin’, ‘average’, ‘count’, ‘distinct’, ‘max’, ‘mean’, ‘median’, ‘min’, ‘missing’, ‘q1’, ‘q3’, ‘ci0’, ‘ci1’, ‘stderr’, ‘stdev’, ‘stdevp’, ‘sum’, ‘valid’, ‘values’, ‘variance’, ‘variancep’)
-
class
altair.
AggregateTransform
(aggregate=Undefined, groupby=Undefined, **kwds)¶ AggregateTransform schema wrapper
Mapping(required=[aggregate])
Attributes: - aggregate : List(AggregatedFieldDef)
Array of objects that define fields to aggregate.
- groupby : List(string)
The data fields to group by. If not specified, a single group containing all data objects will be used.
-
class
altair.
AggregatedFieldDef
(op=Undefined, field=Undefined, **kwds)¶ AggregatedFieldDef schema wrapper
Mapping(required=[op, as])
Attributes: - op : AggregateOp
The aggregation operations to apply to the fields, such as sum, average or count. See the full list of supported aggregation operations for more information.
- field : string
The data field for which to compute aggregate function. This is required for all aggregation operations except
"count"
.- as : string
The output field names to use for each aggregated field.
-
class
altair.
Anchor
(*args)¶ Anchor schema wrapper
enum(‘start’, ‘middle’, ‘end’)
-
class
altair.
AnyMark
(*args, **kwds)¶ AnyMark schema wrapper
anyOf(Mark, MarkDef)
-
class
altair.
AreaConfig
(align=Undefined, angle=Undefined, baseline=Undefined, color=Undefined, cornerRadius=Undefined, cursor=Undefined, dir=Undefined, dx=Undefined, dy=Undefined, ellipsis=Undefined, fill=Undefined, fillOpacity=Undefined, filled=Undefined, font=Undefined, fontSize=Undefined, fontStyle=Undefined, fontWeight=Undefined, href=Undefined, interpolate=Undefined, limit=Undefined, line=Undefined, opacity=Undefined, orient=Undefined, point=Undefined, radius=Undefined, shape=Undefined, size=Undefined, stroke=Undefined, strokeCap=Undefined, strokeDash=Undefined, strokeDashOffset=Undefined, strokeJoin=Undefined, strokeMiterLimit=Undefined, strokeOpacity=Undefined, strokeWidth=Undefined, tension=Undefined, text=Undefined, theta=Undefined, tooltip=Undefined, **kwds)¶ AreaConfig schema wrapper
Mapping(required=[])
Attributes: - align : HorizontalAlign
The horizontal alignment of the text. One of
"left"
,"right"
,"center"
.- angle : float
The rotation angle of the text, in degrees.
- baseline : VerticalAlign
The vertical alignment of the text. One of
"top"
,"middle"
,"bottom"
.Default value:
"middle"
- color : string
Default color. Note that
fill
andstroke
have higher precedence thancolor
and will overridecolor
.Default value: ■
"#4682b4"
Note: This property cannot be used in a style config.
- cornerRadius : float
The radius in pixels of rounded rectangle corners. Default value:
0
- cursor : Cursor
The mouse cursor used over the mark. Any valid CSS cursor type can be used.
- dir : Dir
The direction of the text. One of
"ltr"
(left-to-right) or"rtl"
(right-to-left). This property determines on which side is truncated in response to the limit parameter. Default value:"ltr"
- dx : float
The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- dy : float
The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- ellipsis : string
The ellipsis string for text truncated in response to the limit parameter. Default value:
"…"
- fill : string
Default Fill Color. This has higher precedence than
config.color
Default value: (None)
- fillOpacity : float
The fill opacity (value between [0,1]).
Default value:
1
- filled : boolean
Whether the mark’s color should be used as fill color instead of stroke color.
Default value:
true
for all marks exceptpoint
andfalse
forpoint
.Applicable for:
bar
,point
,circle
,square
, andarea
marks.Note: This property cannot be used in a style config.
- font : string
The typeface to set the text in (e.g.,
"Helvetica Neue"
).- fontSize : float
The font size, in pixels.
- fontStyle : FontStyle
The font style (e.g.,
"italic"
).- fontWeight : FontWeight
The font weight. This can be either a string (e.g
"bold"
,"normal"
) or a number (100
,200
,300
, …,900
where"normal"
=400
and"bold"
=700
).- href : string
A URL to load upon mouse click. If defined, the mark acts as a hyperlink.
- interpolate : Interpolate
The line interpolation method to use for line and area marks. One of the following:
"linear"
: piecewise linear segments, as in a polyline."linear-closed"
: close the linear segments to form a polygon."step"
: alternate between horizontal and vertical segments, as in a step function."step-before"
: alternate between vertical and horizontal segments, as in a step function."step-after"
: alternate between horizontal and vertical segments, as in a step function."basis"
: a B-spline, with control point duplication on the ends."basis-open"
: an open B-spline; may not intersect the start or end."basis-closed"
: a closed B-spline, as in a loop."cardinal"
: a Cardinal spline, with control point duplication on the ends."cardinal-open"
: an open Cardinal spline; may not intersect the start or end, but will intersect other control points."cardinal-closed"
: a closed Cardinal spline, as in a loop."bundle"
: equivalent to basis, except the tension parameter is used to straighten the spline."monotone"
: cubic interpolation that preserves monotonicity in y.
- limit : float
The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. Default value:
0
, indicating no limit- line : anyOf(boolean, OverlayMarkDef)
A flag for overlaying line on top of area marks, or an object defining the properties of the overlayed lines.
If this value is an empty object (
{}
) ortrue
, lines with default properties will be used.If this value is
false
, no lines would be automatically added to area marks.Default value:
false
.- opacity : float
The overall opacity (value between [0,1]).
Default value:
0.7
for non-aggregate plots withpoint
,tick
,circle
, orsquare
marks or layeredbar
charts and1
otherwise.- orient : Orient
The orientation of a non-stacked bar, tick, area, and line charts. The value is either horizontal (default) or vertical.
- For bar, rule and tick, this determines whether the size of the bar and tick
should be applied to x or y dimension. * For area, this property determines the orient property of the Vega output. * For line and trail marks, this property determines the sort order of the points in
the line
if
config.sortLineBy
is not specified. For stacked charts, this is always determined by the orientation of the stack; therefore explicitly specified value will be ignored.- point : anyOf(boolean, MarkConfig, enum(‘transparent’))
A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points.
If this property is
"transparent"
, transparent points will be used (for enhancing tooltips and selections).If this property is an empty object (
{}
) ortrue
, filled points with default properties will be used.If this property is
false
, no points would be automatically added to line or area marks.Default value:
false
.- radius : float
Polar coordinate radial offset, in pixels, of the text label from the origin determined by the
x
andy
properties.- shape : string
The default symbol shape to use. One of:
"circle"
(default),"square"
,"cross"
,"diamond"
,"triangle-up"
, or"triangle-down"
, or a custom SVG path.Default value:
"circle"
- size : float
The pixel area each the point/circle/square. For example: in the case of circles, the radius is determined in part by the square root of the size value.
Default value:
30
- stroke : string
Default Stroke Color. This has higher precedence than
config.color
Default value: (None)
- strokeCap : enum(‘butt’, ‘round’, ‘square’)
The stroke cap for line ending style. One of
"butt"
,"round"
, or"square"
.Default value:
"square"
- strokeDash : List(float)
An array of alternating stroke, space lengths for creating dashed or dotted lines.
- strokeDashOffset : float
The offset (in pixels) into which to begin drawing with the stroke dash array.
- strokeJoin : StrokeJoin
The stroke line join method. One of
"miter"
,"round"
or"bevel"
. Default value:"miter"
- strokeMiterLimit : float
The miter limit at which to bevel a line join.
- strokeOpacity : float
The stroke opacity (value between [0,1]).
Default value:
1
- strokeWidth : float
The stroke width, in pixels.
- tension : float
Depending on the interpolation type, sets the tension parameter (for line and area marks).
- text : string
Placeholder text if the
text
channel is not specified- theta : float
Polar coordinate angle, in radians, of the text label from the origin determined by the
x
andy
properties. Values fortheta
follow the same convention ofarc
markstartAngle
andendAngle
properties: angles are measured in radians, with0
indicating “north”.- tooltip : Mapping(required=[])
The tooltip text to show upon mouse hover.
-
class
altair.
AutoSizeParams
(contains=Undefined, resize=Undefined, type=Undefined, **kwds)¶ AutoSizeParams schema wrapper
Mapping(required=[])
Attributes: - contains : enum(‘content’, ‘padding’)
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.Default value :
"content"
- resize : boolean
A boolean flag indicating if autosize layout should be re-calculated on every view update.
Default value :
false
- type : AutosizeType
The sizing format type. One of
"pad"
,"fit"
or"none"
. See the autosize type documentation for descriptions of each.Default value :
"pad"
-
class
altair.
AutosizeType
(*args)¶ AutosizeType schema wrapper
enum(‘pad’, ‘fit’, ‘none’)
-
class
altair.
Axis
(domain=Undefined, format=Undefined, grid=Undefined, labelAngle=Undefined, labelBound=Undefined, labelFlush=Undefined, labelOverlap=Undefined, labelPadding=Undefined, labels=Undefined, maxExtent=Undefined, minExtent=Undefined, offset=Undefined, orient=Undefined, position=Undefined, tickCount=Undefined, tickSize=Undefined, ticks=Undefined, title=Undefined, titleMaxLength=Undefined, titlePadding=Undefined, values=Undefined, zindex=Undefined, **kwds)¶ Axis schema wrapper
Mapping(required=[])
Attributes: - domain : boolean
A boolean flag indicating if the domain (the axis baseline) should be included as part of the axis.
Default value:
true
- format : string
The formatting pattern for labels. This is D3’s number format pattern for quantitative fields and D3’s time format pattern for time field.
See the format documentation for more information.
Default value: derived from numberFormat config for quantitative fields and from timeFormat config for temporal fields.
- grid : boolean
A boolean flag indicating if grid lines should be included as part of the axis
Default value:
true
for continuous scales that are not binned; otherwise,false
.- labelAngle : float
The rotation angle of the axis labels.
Default value:
-90
for nominal and ordinal fields;0
otherwise.- labelBound : anyOf(boolean, float)
Indicates if labels should be hidden if they exceed the axis range. If
false
(the default) no bounds overlap analysis is performed. Iftrue
, labels will be hidden if they exceed the axis range by more than 1 pixel. If this property is a number, it specifies the pixel tolerance: the maximum amount by which a label bounding box may exceed the axis range.Default value:
false
.- labelFlush : anyOf(boolean, float)
Indicates if the first and last axis labels should be aligned flush with the scale range. Flush alignment for a horizontal axis will left-align the first label and right-align the last label. For vertical axes, bottom and top text baselines are applied instead. If this property is a number, it also indicates the number of pixels by which to offset the first and last labels; for example, a value of 2 will flush-align the first and last labels and also push them 2 pixels outward from the center of the axis. The additional adjustment can sometimes help the labels better visually group with corresponding axis ticks.
Default value:
true
for axis of a continuous x-scale. Otherwise,false
.- labelOverlap : anyOf(boolean, enum(‘parity’), enum(‘greedy’))
The strategy to use for resolving overlap of axis labels. If
false
(the default), no overlap reduction is attempted. If set totrue
or"parity"
, a strategy of removing every other label is used (this works well for standard linear axes). If set to"greedy"
, a linear scan of the labels is performed, removing any labels that overlaps with the last visible label (this often works better for log-scaled axes).Default value:
true
for non-nominal fields with non-log scales;"greedy"
for log scales; otherwisefalse
.- labelPadding : float
The padding, in pixels, between axis and text labels.
- labels : boolean
A boolean flag indicating if labels should be included as part of the axis.
Default value:
true
.- maxExtent : float
The maximum extent in pixels that axis ticks and labels should use. This determines a maximum offset value for axis titles.
Default value:
undefined
.- minExtent : float
The minimum extent in pixels that axis ticks and labels should use. This determines a minimum offset value for axis titles.
Default value:
30
for y-axis;undefined
for x-axis.- offset : float
The offset, in pixels, by which to displace the axis from the edge of the enclosing group or data rectangle.
Default value: derived from the axis config ‘s
offset
(0
by default)- orient : AxisOrient
The orientation of the axis. One of
"top"
,"bottom"
,"left"
or"right"
. The orientation can be used to further specialize the axis type (e.g., a y axis oriented for the right edge of the chart).Default value:
"bottom"
for x-axes and"left"
for y-axes.- position : float
The anchor position of the axis in pixels. For x-axis with top or bottom orientation, this sets the axis group x coordinate. For y-axis with left or right orientation, this sets the axis group y coordinate.
Default value :
0
- tickCount : float
A desired number of ticks, for axes visualizing quantitative scales. The resulting number may be different so that values are “nice” (multiples of 2, 5, 10) and lie within the underlying scale’s range.
- tickSize : float
The size in pixels of axis ticks.
- ticks : boolean
Boolean value that determines whether the axis should include ticks.
- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- titleMaxLength : float
Max length for axis title if the title is automatically generated from the field’s description.
- titlePadding : float
The padding, in pixels, between title and axis.
- values : anyOf(List(float), List(string), List(boolean), List(DateTime))
Explicitly set the visible axis tick values.
- zindex : float
A non-positive integer indicating z-index of the axis. If zindex is 0, axes should be drawn behind all chart elements. To put them in front, use
"zindex = 1"
.Default value:
1
(in front of the marks) for actual axis and0
(behind the marks) for grids.
-
class
altair.
AxisConfig
(bandPosition=Undefined, domain=Undefined, domainColor=Undefined, domainWidth=Undefined, grid=Undefined, gridColor=Undefined, gridDash=Undefined, gridOpacity=Undefined, gridWidth=Undefined, labelAngle=Undefined, labelBound=Undefined, labelColor=Undefined, labelFlush=Undefined, labelFont=Undefined, labelFontSize=Undefined, labelLimit=Undefined, labelOverlap=Undefined, labelPadding=Undefined, labels=Undefined, maxExtent=Undefined, minExtent=Undefined, shortTimeLabels=Undefined, tickColor=Undefined, tickRound=Undefined, tickSize=Undefined, tickWidth=Undefined, ticks=Undefined, titleAlign=Undefined, titleAngle=Undefined, titleBaseline=Undefined, titleColor=Undefined, titleFont=Undefined, titleFontSize=Undefined, titleFontWeight=Undefined, titleLimit=Undefined, titleMaxLength=Undefined, titlePadding=Undefined, titleX=Undefined, titleY=Undefined, **kwds)¶ AxisConfig schema wrapper
Mapping(required=[])
Attributes: - bandPosition : float
An interpolation fraction indicating where, for
band
scales, axis ticks should be positioned. A value of0
places ticks at the left edge of their bands. A value of0.5
places ticks in the middle of their bands.- domain : boolean
A boolean flag indicating if the domain (the axis baseline) should be included as part of the axis.
Default value:
true
- domainColor : string
Color of axis domain line.
Default value: (none, using Vega default).
- domainWidth : float
Stroke width of axis domain line
Default value: (none, using Vega default).
- grid : boolean
A boolean flag indicating if grid lines should be included as part of the axis
Default value:
true
for continuous scales that are not binned; otherwise,false
.- gridColor : string
Color of gridlines.
- gridDash : List(float)
The offset (in pixels) into which to begin drawing with the grid dash array.
- gridOpacity : float
The stroke opacity of grid (value between [0,1])
Default value: (
1
by default)- gridWidth : float
The grid width, in pixels.
- labelAngle : float
The rotation angle of the axis labels.
Default value:
-90
for nominal and ordinal fields;0
otherwise.- labelBound : anyOf(boolean, float)
Indicates if labels should be hidden if they exceed the axis range. If
false
(the default) no bounds overlap analysis is performed. Iftrue
, labels will be hidden if they exceed the axis range by more than 1 pixel. If this property is a number, it specifies the pixel tolerance: the maximum amount by which a label bounding box may exceed the axis range.Default value:
false
.- labelColor : string
The color of the tick label, can be in hex color code or regular color name.
- labelFlush : anyOf(boolean, float)
Indicates if the first and last axis labels should be aligned flush with the scale range. Flush alignment for a horizontal axis will left-align the first label and right-align the last label. For vertical axes, bottom and top text baselines are applied instead. If this property is a number, it also indicates the number of pixels by which to offset the first and last labels; for example, a value of 2 will flush-align the first and last labels and also push them 2 pixels outward from the center of the axis. The additional adjustment can sometimes help the labels better visually group with corresponding axis ticks.
Default value:
true
for axis of a continuous x-scale. Otherwise,false
.- labelFont : string
The font of the tick label.
- labelFontSize : float
The font size of the label, in pixels.
- labelLimit : float
Maximum allowed pixel width of axis tick labels.
- labelOverlap : anyOf(boolean, enum(‘parity’), enum(‘greedy’))
The strategy to use for resolving overlap of axis labels. If
false
(the default), no overlap reduction is attempted. If set totrue
or"parity"
, a strategy of removing every other label is used (this works well for standard linear axes). If set to"greedy"
, a linear scan of the labels is performed, removing any labels that overlaps with the last visible label (this often works better for log-scaled axes).Default value:
true
for non-nominal fields with non-log scales;"greedy"
for log scales; otherwisefalse
.- labelPadding : float
The padding, in pixels, between axis and text labels.
- labels : boolean
A boolean flag indicating if labels should be included as part of the axis.
Default value:
true
.- maxExtent : float
The maximum extent in pixels that axis ticks and labels should use. This determines a maximum offset value for axis titles.
Default value:
undefined
.- minExtent : float
The minimum extent in pixels that axis ticks and labels should use. This determines a minimum offset value for axis titles.
Default value:
30
for y-axis;undefined
for x-axis.- shortTimeLabels : boolean
Whether month names and weekday names should be abbreviated.
Default value:
false
- tickColor : string
The color of the axis’s tick.
- tickRound : boolean
Boolean flag indicating if pixel position values should be rounded to the nearest integer.
- tickSize : float
The size in pixels of axis ticks.
- tickWidth : float
The width, in pixels, of ticks.
- ticks : boolean
Boolean value that determines whether the axis should include ticks.
- titleAlign : string
Horizontal text alignment of axis titles.
- titleAngle : float
Angle in degrees of axis titles.
- titleBaseline : string
Vertical text baseline for axis titles.
- titleColor : string
Color of the title, can be in hex color code or regular color name.
- titleFont : string
Font of the title. (e.g.,
"Helvetica Neue"
).- titleFontSize : float
Font size of the title.
- titleFontWeight : FontWeight
Font weight of the title. This can be either a string (e.g
"bold"
,"normal"
) or a number (100
,200
,300
, …,900
where"normal"
=400
and"bold"
=700
).- titleLimit : float
Maximum allowed pixel width of axis titles.
- titleMaxLength : float
Max length for axis title if the title is automatically generated from the field’s description.
- titlePadding : float
The padding, in pixels, between title and axis.
- titleX : float
X-coordinate of the axis title relative to the axis group.
- titleY : float
Y-coordinate of the axis title relative to the axis group.
-
class
altair.
AxisOrient
(*args)¶ AxisOrient schema wrapper
enum(‘top’, ‘right’, ‘left’, ‘bottom’)
-
class
altair.
AxisResolveMap
(x=Undefined, y=Undefined, **kwds)¶ AxisResolveMap schema wrapper
Mapping(required=[])
Attributes: - x : ResolveMode
- y : ResolveMode
-
class
altair.
BarConfig
(align=Undefined, angle=Undefined, baseline=Undefined, binSpacing=Undefined, color=Undefined, continuousBandSize=Undefined, cornerRadius=Undefined, cursor=Undefined, dir=Undefined, discreteBandSize=Undefined, dx=Undefined, dy=Undefined, ellipsis=Undefined, fill=Undefined, fillOpacity=Undefined, filled=Undefined, font=Undefined, fontSize=Undefined, fontStyle=Undefined, fontWeight=Undefined, href=Undefined, interpolate=Undefined, limit=Undefined, opacity=Undefined, orient=Undefined, radius=Undefined, shape=Undefined, size=Undefined, stroke=Undefined, strokeCap=Undefined, strokeDash=Undefined, strokeDashOffset=Undefined, strokeJoin=Undefined, strokeMiterLimit=Undefined, strokeOpacity=Undefined, strokeWidth=Undefined, tension=Undefined, text=Undefined, theta=Undefined, tooltip=Undefined, **kwds)¶ BarConfig schema wrapper
Mapping(required=[])Attributes: - align : HorizontalAlign
The horizontal alignment of the text. One of
"left"
,"right"
,"center"
.- angle : float
The rotation angle of the text, in degrees.
- baseline : VerticalAlign
The vertical alignment of the text. One of
"top"
,"middle"
,"bottom"
.Default value:
"middle"
- binSpacing : float
Offset between bars for binned field. Ideal value for this is either 0 (Preferred by statisticians) or 1 (Vega-Lite Default, D3 example style).
Default value:
1
- color : string
Default color. Note that
fill
andstroke
have higher precedence thancolor
and will overridecolor
.Default value: ■
"#4682b4"
Note: This property cannot be used in a style config.
- continuousBandSize : float
The default size of the bars on continuous scales. Default value:
5
- cornerRadius : float
The radius in pixels of rounded rectangle corners. Default value:
0
- cursor : Cursor
The mouse cursor used over the mark. Any valid CSS cursor type can be used.
- dir : Dir
The direction of the text. One of
"ltr"
(left-to-right) or"rtl"
(right-to-left). This property determines on which side is truncated in response to the limit parameter. Default value:"ltr"
- discreteBandSize : float
The size of the bars. If unspecified, the default size is
bandSize-1
, which provides 1 pixel offset between bars.- dx : float
The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- dy : float
The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- ellipsis : string
The ellipsis string for text truncated in response to the limit parameter. Default value:
"…"
- fill : string
Default Fill Color. This has higher precedence than
config.color
Default value: (None)
- fillOpacity : float
The fill opacity (value between [0,1]).
Default value:
1
- filled : boolean
Whether the mark’s color should be used as fill color instead of stroke color.
Default value:
true
for all marks exceptpoint
andfalse
forpoint
.Applicable for:
bar
,point
,circle
,square
, andarea
marks.Note: This property cannot be used in a style config.
- font : string
The typeface to set the text in (e.g.,
"Helvetica Neue"
).- fontSize : float
The font size, in pixels.
- fontStyle : FontStyle
The font style (e.g.,
"italic"
).- fontWeight : FontWeight
The font weight. This can be either a string (e.g
"bold"
,"normal"
) or a number (100
,200
,300
, …,900
where"normal"
=400
and"bold"
=700
).- href : string
A URL to load upon mouse click. If defined, the mark acts as a hyperlink.
- interpolate : Interpolate
The line interpolation method to use for line and area marks. One of the following:
"linear"
: piecewise linear segments, as in a polyline."linear-closed"
: close the linear segments to form a polygon."step"
: alternate between horizontal and vertical segments, as in a step function."step-before"
: alternate between vertical and horizontal segments, as in a step function."step-after"
: alternate between horizontal and vertical segments, as in a step function."basis"
: a B-spline, with control point duplication on the ends."basis-open"
: an open B-spline; may not intersect the start or end."basis-closed"
: a closed B-spline, as in a loop."cardinal"
: a Cardinal spline, with control point duplication on the ends."cardinal-open"
: an open Cardinal spline; may not intersect the start or end, but will intersect other control points."cardinal-closed"
: a closed Cardinal spline, as in a loop."bundle"
: equivalent to basis, except the tension parameter is used to straighten the spline."monotone"
: cubic interpolation that preserves monotonicity in y.
- limit : float
The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. Default value:
0
, indicating no limit- opacity : float
The overall opacity (value between [0,1]).
Default value:
0.7
for non-aggregate plots withpoint
,tick
,circle
, orsquare
marks or layeredbar
charts and1
otherwise.- orient : Orient
The orientation of a non-stacked bar, tick, area, and line charts. The value is either horizontal (default) or vertical.
- For bar, rule and tick, this determines whether the size of the bar and tick
should be applied to x or y dimension. * For area, this property determines the orient property of the Vega output. * For line and trail marks, this property determines the sort order of the points in
the line
if
config.sortLineBy
is not specified. For stacked charts, this is always determined by the orientation of the stack; therefore explicitly specified value will be ignored.- radius : float
Polar coordinate radial offset, in pixels, of the text label from the origin determined by the
x
andy
properties.- shape : string
The default symbol shape to use. One of:
"circle"
(default),"square"
,"cross"
,"diamond"
,"triangle-up"
, or"triangle-down"
, or a custom SVG path.Default value:
"circle"
- size : float
The pixel area each the point/circle/square. For example: in the case of circles, the radius is determined in part by the square root of the size value.
Default value:
30
stroke : string
- <<<<<<< HEAD
Default Stroke Color. This has higher precedence than
config.color
Default value: (None)
strokeCap : enum(‘butt’, ‘round’, ‘square’)
- =======
Default Stroke Color. This has higher precedence than
config.color
Default value: (None)strokeCap : StrokeCap
- >>>>>>> altair-viz/master
The stroke cap for line ending style. One of
"butt"
,"round"
, or"square"
.Default value:
"square"
- strokeDash : List(float)
An array of alternating stroke, space lengths for creating dashed or dotted lines.
- strokeDashOffset : float
The offset (in pixels) into which to begin drawing with the stroke dash array.
- strokeJoin : StrokeJoin
The stroke line join method. One of
"miter"
,"round"
or"bevel"
. Default value:"miter"
- strokeMiterLimit : float
The miter limit at which to bevel a line join.
- strokeOpacity : float
The stroke opacity (value between [0,1]).
Default value:
1
- strokeWidth : float
The stroke width, in pixels.
- tension : float
Depending on the interpolation type, sets the tension parameter (for line and area marks).
- text : string
Placeholder text if the
text
channel is not specified- theta : float
Polar coordinate angle, in radians, of the text label from the origin determined by the
x
andy
properties. Values fortheta
follow the same convention ofarc
markstartAngle
andendAngle
properties: angles are measured in radians, with0
indicating “north”.- tooltip : Mapping(required=[])
The tooltip text to show upon mouse hover.
-
class
altair.
Baseline
(*args)¶ Baseline schema wrapper
enum(‘top’, ‘middle’, ‘bottom’)
-
class
altair.
BasicType
(*args)¶ BasicType schema wrapper
enum(‘quantitative’, ‘ordinal’, ‘temporal’, ‘nominal’)
-
altair.
Bin
¶ alias of
altair.vegalite.v2.schema.core.BinParams
-
class
altair.
BinParams
(anchor=Undefined, base=Undefined, divide=Undefined, extent=Undefined, maxbins=Undefined, minstep=Undefined, nice=Undefined, step=Undefined, steps=Undefined, **kwds)¶ BinParams schema wrapper
Mapping(required=[]) Binning properties or boolean flag for determining whether to bin data or not.Attributes: - <<<<<<< HEAD
- =======
- anchor : float
A value in the binned domain at which to anchor the bins, shifting the bin boundaries if necessary to ensure that a boundary aligns with the anchor value. Default Value: the minimum bin extent value
- >>>>>>> altair-viz/master
- base : float
The number base to use for automatic bin determination (default is base 10).
Default value:
10
- divide : List(float)
Scale factors indicating allowable subdivisions. The default value is [5, 2], which indicates that for base 10 numbers (the default base), the method may consider dividing bin sizes by 5 and/or 2. For example, for an initial step size of 10, the method can check if bin sizes of 2 (= 10/5), 5 (= 10/2), or 1 (= 10/(5*2)) might also satisfy the given constraints.
Default value:
[5, 2]
- extent : List(float)
A two-element (
[min, max]
) array indicating the range of desired bin values.- maxbins : float
Maximum number of bins.
Default value:
6
forrow
,column
andshape
channels;10
for other channels- minstep : float
A minimum allowable step size (particularly useful for integer values).
- nice : boolean
If true (the default), attempts to make the bin boundaries use human-friendly boundaries, such as multiples of ten.
- step : float
An exact step size to use between bins.
Note: If provided, options such as maxbins will be ignored.
- steps : List(float)
An array of allowable step sizes to choose from.
-
class
altair.
BinTransform
(bin=Undefined, field=Undefined, **kwds)¶ BinTransform schema wrapper
Mapping(required=[bin, field, as])
Attributes: - bin : anyOf(boolean, BinParams)
An object indicating bin properties, or simply
true
for using default bin parameters.- field : string
The data field to bin.
- as : anyOf(string, List(string))
The output fields at which to write the start and end bin values.
-
class
altair.
BrushConfig
(fill=Undefined, fillOpacity=Undefined, stroke=Undefined, strokeDash=Undefined, strokeDashOffset=Undefined, strokeOpacity=Undefined, strokeWidth=Undefined, **kwds)¶ BrushConfig schema wrapper
Mapping(required=[])
Attributes: - fill : string
The fill color of the interval mark.
Default value:
#333333
- fillOpacity : float
The fill opacity of the interval mark (a value between 0 and 1).
Default value:
0.125
- stroke : string
The stroke color of the interval mark.
Default value:
#ffffff
- strokeDash : List(float)
An array of alternating stroke and space lengths, for creating dashed or dotted lines.
- strokeDashOffset : float
The offset (in pixels) with which to begin drawing the stroke dash array.
- strokeOpacity : float
The stroke opacity of the interval mark (a value between 0 and 1).
- strokeWidth : float
The stroke width of the interval mark.
-
class
altair.
CalculateTransform
(calculate=Undefined, **kwds)¶ CalculateTransform schema wrapper
Mapping(required=[calculate, as])
Attributes: - calculate : string
A expression string. Use the variable
datum
to refer to the current data object.- as : string
The field for storing the computed formula value.
-
class
altair.
Color
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds) Color schema wrapper
Mapping(required=[shorthand]) A FieldDef with Condition
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- legend : anyOf(Legend, None)
An object defining properties of the legend. If
null
, the legend for the encoding channel will be removed.Default value: If undefined, default legend properties are applied.
- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
ColorValue
(value, condition=Undefined, **kwds) ColorValue schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalMarkPropFieldDef, ConditionalValueDef,
- List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
Column
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, header=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds) Column schema wrapper
Mapping(required=[shorthand])
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- header : Header
An object defining properties of a facet’s header.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
CompositeUnitSpec
(mark=Undefined, data=Undefined, description=Undefined, encoding=Undefined, height=Undefined, name=Undefined, projection=Undefined, selection=Undefined, title=Undefined, transform=Undefined, width=Undefined, **kwds)¶ CompositeUnitSpec schema wrapper
Mapping(required=[mark])
Attributes: - mark : AnyMark
A string describing the mark type (one of
"bar"
,"circle"
,"square"
,"tick"
,"line"
,"area"
,"point"
,"rule"
,"geoshape"
, and"text"
) or a mark definition object.- data : Data
An object describing the data source
- description : string
Description of this mark for commenting purpose.
- encoding : Encoding
A key-value mapping between encoding channels and definition of fields.
- height : float
The height of a visualization.
Default value:
- If a view’s autosize
type is
"fit"
or its y-channel has a continuous scale, the height will be the value of config.view.height. - For y-axis with a band or point scale: if rangeStep is a numeric value or
unspecified, the height is determined by the range step, paddings, and the
cardinality of the field mapped to y-channel. Otherwise, if the
rangeStep
isnull
, the height will be the value of config.view.height. - If no field is mapped to
y
channel, theheight
will be the value ofrangeStep
.
Note : For plots with row and column channels, this represents the height of a single view.
See also: The documentation for width and height contains more examples.
- If a view’s autosize
type is
- name : string
Name of the visualization for later reference.
- projection : Projection
An object defining properties of geographic projection, which will be applied to
shape
path for"geoshape"
marks and tolatitude
and"longitude"
channels for other marks.- selection : Mapping(required=[])
A key-value mapping between selection names and definitions.
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- width : float
The width of a visualization.
Default value: This will be determined by the following rules:
- If a view’s autosize
type is
"fit"
or its x-channel has a continuous scale, the width will be the value of config.view.width. - For x-axis with a band or point scale: if rangeStep is a numeric value or
unspecified, the width is determined by the range step, paddings, and the
cardinality of the field mapped to x-channel. Otherwise, if the
rangeStep
isnull
, the width will be the value of config.view.width. - If no field is mapped to
x
channel, thewidth
will be the value of config.scale.textXRangeStep fortext
mark and the value ofrangeStep
for other marks.
Note: For plots with row and column channels, this represents the width of a single view.
See also: The documentation for width and height contains more examples.
- If a view’s autosize
type is
-
class
altair.
CompositeUnitSpecAlias
(mark=Undefined, data=Undefined, description=Undefined, encoding=Undefined, height=Undefined, name=Undefined, projection=Undefined, selection=Undefined, title=Undefined, transform=Undefined, width=Undefined, **kwds)¶ CompositeUnitSpecAlias schema wrapper
Mapping(required=[mark])
Attributes: - mark : AnyMark
A string describing the mark type (one of
"bar"
,"circle"
,"square"
,"tick"
,"line"
,"area"
,"point"
,"rule"
,"geoshape"
, and"text"
) or a mark definition object.- data : Data
An object describing the data source
- description : string
Description of this mark for commenting purpose.
- encoding : Encoding
A key-value mapping between encoding channels and definition of fields.
- height : float
The height of a visualization.
Default value:
- If a view’s autosize
type is
"fit"
or its y-channel has a continuous scale, the height will be the value of config.view.height. - For y-axis with a band or point scale: if rangeStep is a numeric value or
unspecified, the height is determined by the range step, paddings, and the
cardinality of the field mapped to y-channel. Otherwise, if the
rangeStep
isnull
, the height will be the value of config.view.height. - If no field is mapped to
y
channel, theheight
will be the value ofrangeStep
.
Note : For plots with row and column channels, this represents the height of a single view.
See also: The documentation for width and height contains more examples.
- If a view’s autosize
type is
- name : string
Name of the visualization for later reference.
- projection : Projection
An object defining properties of geographic projection, which will be applied to
shape
path for"geoshape"
marks and tolatitude
and"longitude"
channels for other marks.- selection : Mapping(required=[])
A key-value mapping between selection names and definitions.
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- width : float
The width of a visualization.
Default value: This will be determined by the following rules:
- If a view’s autosize
type is
"fit"
or its x-channel has a continuous scale, the width will be the value of config.view.width. - For x-axis with a band or point scale: if rangeStep is a numeric value or
unspecified, the width is determined by the range step, paddings, and the
cardinality of the field mapped to x-channel. Otherwise, if the
rangeStep
isnull
, the width will be the value of config.view.width. - If no field is mapped to
x
channel, thewidth
will be the value of config.scale.textXRangeStep fortext
mark and the value ofrangeStep
for other marks.
Note: For plots with row and column channels, this represents the width of a single view.
See also: The documentation for width and height contains more examples.
- If a view’s autosize
type is
-
class
altair.
ConditionalFieldDef
(*args, **kwds)¶ ConditionalFieldDef schema wrapper
anyOf(ConditionalPredicateFieldDef, ConditionalSelectionFieldDef)
-
class
altair.
ConditionalMarkPropFieldDef
(*args, **kwds)¶ ConditionalMarkPropFieldDef schema wrapper
anyOf(ConditionalPredicateMarkPropFieldDef, ConditionalSelectionMarkPropFieldDef)
-
class
altair.
ConditionalPredicateFieldDef
(test=Undefined, type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, **kwds)¶ ConditionalPredicateFieldDef schema wrapper
Mapping(required=[test, type])
Attributes: - test : LogicalOperandPredicate
- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.
-
class
altair.
ConditionalPredicateMarkPropFieldDef
(test=Undefined, type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, **kwds)¶ ConditionalPredicateMarkPropFieldDef schema wrapper
Mapping(required=[test, type])Attributes: - test : LogicalOperandPredicate
- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- legend : anyOf(Legend, None)
An object defining properties of the legend. If
null
, the legend for the encoding channel will be removed.Default value: If undefined, default legend properties are applied.
- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- <<<<<<< HEAD
- sort : anyOf(List(string), SortOrder, EncodingSortField, None)
Sort order for the encoded field. Supported
sort
values include"ascending"
,"descending"
,null
(no sorting), or an array specifying the preferred order of values. For fields with discrete domains,sort
can also be a sort field definition object. Forsort
as an array specifying the preferred order of values, the sort order will obey the values in the array, followed by any unspecified values in their original order.Default value:
"ascending"
- =======
- sort : 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"
– forsorting by the values’ natural order in Javascript. * `A sort field definition
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`_ for sorting by another field. * An array specifying the field values in preferred order. In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). *null
indicating no sort. Default value:"ascending"
Note:null
is not supported forrow
andcolumn
.
- >>>>>>> altair-viz/master
- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.
-
class
altair.
ConditionalPredicateTextFieldDef
(test=Undefined, type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, format=Undefined, timeUnit=Undefined, title=Undefined, **kwds)¶ ConditionalPredicateTextFieldDef schema wrapper
Mapping(required=[test, type])
Attributes: - test : LogicalOperandPredicate
- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- format : string
The formatting pattern for a text field. If not defined, this will be determined automatically.
- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.
-
class
altair.
ConditionalPredicateValueDef
(test=Undefined, value=Undefined, **kwds)¶ ConditionalPredicateValueDef schema wrapper
Mapping(required=[test, value])
Attributes: - test : LogicalOperandPredicate
- value : anyOf(float, string, boolean)
A constant value in visual domain (e.g.,
"red"
/ “#0099ff” for color, values between0
to1
for opacity).
-
class
altair.
ConditionalSelectionFieldDef
(selection=Undefined, type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, **kwds)¶ ConditionalSelectionFieldDef schema wrapper
Mapping(required=[selection, type])
Attributes: - selection : SelectionOperand
A selection name, or a series of composed selections.
- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.
-
class
altair.
ConditionalSelectionMarkPropFieldDef
(selection=Undefined, type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, **kwds)¶ ConditionalSelectionMarkPropFieldDef schema wrapper
Mapping(required=[selection, type])Attributes: - selection : SelectionOperand
A selection name, or a series of composed selections.
- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- legend : anyOf(Legend, None)
An object defining properties of the legend. If
null
, the legend for the encoding channel will be removed.Default value: If undefined, default legend properties are applied.
- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- <<<<<<< HEAD
- sort : anyOf(List(string), SortOrder, EncodingSortField, None)
Sort order for the encoded field. Supported
sort
values include"ascending"
,"descending"
,null
(no sorting), or an array specifying the preferred order of values. For fields with discrete domains,sort
can also be a sort field definition object. Forsort
as an array specifying the preferred order of values, the sort order will obey the values in the array, followed by any unspecified values in their original order.Default value:
"ascending"
- =======
- sort : 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"
– forsorting by the values’ natural order in Javascript. * `A sort field definition
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`_ for sorting by another field. * An array specifying the field values in preferred order. In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). *null
indicating no sort. Default value:"ascending"
Note:null
is not supported forrow
andcolumn
.
- >>>>>>> altair-viz/master
- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.
-
class
altair.
ConditionalSelectionTextFieldDef
(selection=Undefined, type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, format=Undefined, timeUnit=Undefined, title=Undefined, **kwds)¶ ConditionalSelectionTextFieldDef schema wrapper
Mapping(required=[selection, type])
Attributes: - selection : SelectionOperand
A selection name, or a series of composed selections.
- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- format : string
The formatting pattern for a text field. If not defined, this will be determined automatically.
- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.
-
class
altair.
ConditionalSelectionValueDef
(selection=Undefined, value=Undefined, **kwds)¶ ConditionalSelectionValueDef schema wrapper
Mapping(required=[selection, value])
Attributes: - selection : SelectionOperand
A selection name, or a series of composed selections.
- value : anyOf(float, string, boolean)
A constant value in visual domain (e.g.,
"red"
/ “#0099ff” for color, values between0
to1
for opacity).
-
class
altair.
ConditionalTextFieldDef
(*args, **kwds)¶ ConditionalTextFieldDef schema wrapper
anyOf(ConditionalPredicateTextFieldDef, ConditionalSelectionTextFieldDef)
-
class
altair.
ConditionalValueDef
(*args, **kwds)¶ ConditionalValueDef schema wrapper
anyOf(ConditionalPredicateValueDef, ConditionalSelectionValueDef)
-
class
altair.
Config
(area=Undefined, autosize=Undefined, axis=Undefined, axisBand=Undefined, axisBottom=Undefined, axisLeft=Undefined, axisRight=Undefined, axisTop=Undefined, axisX=Undefined, axisY=Undefined, background=Undefined, bar=Undefined, circle=Undefined, countTitle=Undefined, datasets=Undefined, fieldTitle=Undefined, geoshape=Undefined, header=Undefined, invalidValues=Undefined, legend=Undefined, line=Undefined, mark=Undefined, numberFormat=Undefined, padding=Undefined, point=Undefined, projection=Undefined, range=Undefined, rect=Undefined, rule=Undefined, scale=Undefined, selection=Undefined, square=Undefined, stack=Undefined, style=Undefined, text=Undefined, tick=Undefined, timeFormat=Undefined, title=Undefined, trail=Undefined, view=Undefined, **kwds)¶ Config schema wrapper
Mapping(required=[])
Attributes: - area : AreaConfig
Area-Specific Config
- autosize : anyOf(AutosizeType, AutoSizeParams)
Sets how the visualization size should be determined. If a string, should be one of
"pad"
,"fit"
or"none"
. Object values can additionally specify parameters for content sizing and automatic resizing."fit"
is only supported for single and layered views that don’t userangeStep
.Default value :
pad
- axis : AxisConfig
Axis configuration, which determines default properties for all
x
andy
axes. For a full list of axis configuration options, please see the corresponding section of the axis documentation.- axisBand : VgAxisConfig
Specific axis config for axes with “band” scales.
- axisBottom : VgAxisConfig
Specific axis config for x-axis along the bottom edge of the chart.
- axisLeft : VgAxisConfig
Specific axis config for y-axis along the left edge of the chart.
- axisRight : VgAxisConfig
Specific axis config for y-axis along the right edge of the chart.
- axisTop : VgAxisConfig
Specific axis config for x-axis along the top edge of the chart.
- axisX : VgAxisConfig
X-axis specific config.
- axisY : VgAxisConfig
Y-axis specific config.
- background : string
CSS color property to use as the background of visualization.
Default value: none (transparent)
- bar : BarConfig
Bar-Specific Config
- circle : MarkConfig
Circle-Specific Config
- countTitle : string
Default axis and legend title for count fields.
Default value:
'Number of Records'
.- datasets : Datasets
A global data store for named datasets. This is a mapping from names to inline datasets. This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a
data
property.- fieldTitle : enum(‘verbal’, ‘functional’, ‘plain’)
Defines how Vega-Lite generates title for fields. There are three possible styles:
"verbal"
(Default) - displays function in a verbal style (e.g., “Sum of field”, “Year-month of date”, “field (binned)”)."function"
- displays function using parentheses and capitalized texts (e.g., “SUM(field)”, “YEARMONTH(date)”, “BIN(field)”)."plain"
- displays only the field name without functions (e.g., “field”, “date”, “field”).
- geoshape : MarkConfig
Geoshape-Specific Config
- header : HeaderConfig
Header configuration, which determines default properties for all header. For a full list of header configuration options, please see the corresponding section of in the header documentation.
- invalidValues : enum(‘filter’, None)
Defines how Vega-Lite should handle invalid values (
null
andNaN
).- If set to
"filter"
(default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks). - If
null
, all data items are included. In this case, invalid values will be interpreted as zeroes.
- If set to
- legend : LegendConfig
Legend configuration, which determines default properties for all legends. For a full list of legend configuration options, please see the corresponding section of in the legend documentation.
- line : LineConfig
Line-Specific Config
- mark : MarkConfig
Mark Config
- numberFormat : string
D3 Number format for axis labels and text tables. For example “s” for SI units. Use D3’s number format pattern.
- padding : Padding
The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format
{"left": 5, "top": 5, "right": 5, "bottom": 5}
to specify padding for each side of the visualization.Default value :
5
- point : MarkConfig
Point-Specific Config
- projection : ProjectionConfig
Projection configuration, which determines default properties for all projections. For a full list of projection configuration options, please see the corresponding section of the projection documentation.
- range : RangeConfig
An object hash that defines default range arrays or schemes for using with scales. For a full list of scale range configuration options, please see the corresponding section of the scale documentation.
- rect : MarkConfig
Rect-Specific Config
- rule : MarkConfig
Rule-Specific Config
- scale : ScaleConfig
Scale configuration determines default properties for all scales. For a full list of scale configuration options, please see the corresponding section of the scale documentation.
- selection : SelectionConfig
An object hash for defining default properties for each type of selections.
- square : MarkConfig
Square-Specific Config
- stack : StackOffset
Default stack offset for stackable mark.
- style : StyleConfigIndex
An object hash that defines key-value mappings to determine default properties for marks with a given style. The keys represent styles names; the values have to be valid mark configuration objects.
- text : TextConfig
Text-Specific Config
- tick : TickConfig
Tick-Specific Config
- timeFormat : string
Default datetime format for axis and legend labels. The format can be set directly on each axis and legend. Use D3’s time format pattern.
Default value:
''
(The format will be automatically determined).- title : VgTitleConfig
Title configuration, which determines default properties for all titles. For a full list of title configuration options, please see the corresponding section of the title documentation.
- trail : LineConfig
Trail-Specific Config
- view : ViewConfig
Default properties for single view plots.
-
class
altair.
CsvDataFormat
(parse=Undefined, type=Undefined, **kwds)¶ CsvDataFormat schema wrapper
Mapping(required=[])
Attributes: - parse : anyOf(enum(‘auto’), Parse, None)
If set to
"auto"
(the default), perform automatic type inference to determine the desired data types. If set tonull
, disable type inference based on the spec and only use type inference based on the data. Alternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of"number"
,"boolean"
,"date"
, or null (do not parse the field)). For example,"parse": {"modified_on": "date"}
parses themodified_on
field in each input record a Date value.For
"date"
, we parse data based using Javascript’s Date.parse(). For Specific date formats can be provided (e.g.,{foo: 'date:"%m%d%Y"'}
), using the d3-time-format syntax. UTC date format parsing is supported similarly (e.g.,{foo: 'utc:"%m%d%Y"'}
). See more about UTC time- type : enum(‘csv’, ‘tsv’)
Type of input data:
"json"
,"csv"
,"tsv"
,"dsv"
. The default format type is determined by the extension of the file URL. If no extension is detected,"json"
will be used by default.
-
class
altair.
Cursor
(*args)¶ Cursor schema wrapper
enum(‘auto’, ‘default’, ‘none’, ‘context-menu’, ‘help’, ‘pointer’, ‘progress’, ‘wait’, ‘cell’, ‘crosshair’, ‘text’, ‘vertical-text’, ‘alias’, ‘copy’, ‘move’, ‘no-drop’, ‘not-allowed’, ‘e-resize’, ‘n-resize’, ‘ne-resize’, ‘nw-resize’, ‘s-resize’, ‘se-resize’, ‘sw-resize’, ‘w-resize’, ‘ew-resize’, ‘ns-resize’, ‘nesw-resize’, ‘nwse-resize’, ‘col-resize’, ‘row-resize’, ‘all-scroll’, ‘zoom-in’, ‘zoom-out’, ‘grab’, ‘grabbing’)
-
class
altair.
Data
(*args, **kwds)¶ Data schema wrapper
anyOf(UrlData, InlineData, NamedData)
-
class
altair.
DataFormat
(*args, **kwds)¶ DataFormat schema wrapper
anyOf(CsvDataFormat, DsvDataFormat, JsonDataFormat, TopoDataFormat)
-
class
altair.
Datasets
(**kwds)¶ Datasets schema wrapper
Mapping(required=[])
-
class
altair.
DateTime
(date=Undefined, day=Undefined, hours=Undefined, milliseconds=Undefined, minutes=Undefined, month=Undefined, quarter=Undefined, seconds=Undefined, utc=Undefined, year=Undefined, **kwds)¶ DateTime schema wrapper
Mapping(required=[]) Object for defining datetime in Vega-Lite Filter. If both month and quarter are provided, month has higher precedence.
day
cannot be combined with other date. We accept string for month and day names.Attributes: - date : float
Integer value representing the date from 1-31.
- day : anyOf(Day, string)
Value representing the day of a week. This can be one of: (1) integer value –
1
represents Monday; (2) case-insensitive day name (e.g.,"Monday"
); (3) case-insensitive, 3-character short day name (e.g.,"Mon"
).
Warning: A DateTime definition object withday
** should not be combined withyear
,quarter
,month
, ordate
.- hours : float
Integer value representing the hour of a day from 0-23.
- milliseconds : float
Integer value representing the millisecond segment of time.
- minutes : float
Integer value representing the minute segment of time from 0-59.
- month : anyOf(Month, string)
One of: (1) integer value representing the month from
1
-12
.1
represents January; (2) case-insensitive month name (e.g.,"January"
); (3) case-insensitive, 3-character short month name (e.g.,"Jan"
).- quarter : float
Integer value representing the quarter of the year (from 1-4).
- seconds : float
Integer value representing the second segment (0-59) of a time value
- utc : boolean
A boolean flag indicating if date time is in utc time. If false, the date time is in local time
- year : float
Integer value representing the year.
-
class
altair.
Day
(*args)¶ Day schema wrapper
float
-
class
altair.
Detail
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds) Detail schema wrapper
Mapping(required=[shorthand]) Definition object for a data field, its type and transformation of an encoding channel.
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
DictInlineDataset
(**kwds)¶ DictInlineDataset schema wrapper
Mapping(required=[])
-
class
altair.
Dir
(*args)¶ Dir schema wrapper
enum(‘ltr’, ‘rtl’)
-
class
altair.
DsvDataFormat
(delimiter=Undefined, parse=Undefined, type=Undefined, **kwds)¶ DsvDataFormat schema wrapper
Mapping(required=[delimiter])
Attributes: - delimiter : string
The delimiter between records. The delimiter must be a single character (i.e., a single 16-bit code unit); so, ASCII delimiters are fine, but emoji delimiters are not.
- parse : anyOf(enum(‘auto’), Parse, None)
If set to
"auto"
(the default), perform automatic type inference to determine the desired data types. If set tonull
, disable type inference based on the spec and only use type inference based on the data. Alternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of"number"
,"boolean"
,"date"
, or null (do not parse the field)). For example,"parse": {"modified_on": "date"}
parses themodified_on
field in each input record a Date value.For
"date"
, we parse data based using Javascript’s Date.parse(). For Specific date formats can be provided (e.g.,{foo: 'date:"%m%d%Y"'}
), using the d3-time-format syntax. UTC date format parsing is supported similarly (e.g.,{foo: 'utc:"%m%d%Y"'}
). See more about UTC time- type : enum(‘dsv’)
Type of input data:
"json"
,"csv"
,"tsv"
,"dsv"
. The default format type is determined by the extension of the file URL. If no extension is detected,"json"
will be used by default.
-
class
altair.
Encoding
(color=Undefined, detail=Undefined, fill=Undefined, href=Undefined, key=Undefined, latitude=Undefined, latitude2=Undefined, longitude=Undefined, longitude2=Undefined, opacity=Undefined, order=Undefined, shape=Undefined, size=Undefined, stroke=Undefined, text=Undefined, tooltip=Undefined, x=Undefined, x2=Undefined, y=Undefined, y2=Undefined, **kwds)¶ Encoding schema wrapper
Mapping(required=[])
Attributes: - color : anyOf(MarkPropFieldDefWithCondition, MarkPropValueDefWithCondition)
Color of the marks – either fill or stroke color based on the
filled
property of mark definition. By default,color
represents fill color for"area"
,"bar"
,"tick"
,"text"
,"trail"
,"circle"
, and"square"
/ stroke color for"line"
and"point"
.Default value: If undefined, the default color depends on mark config ‘s
color
property.Note: 1) For fine-grained control over both fill and stroke colors of the marks, please use the
fill
andstroke
channels. If eitherfill
orstroke
channel is specified,color
channel will be ignored. 2) See the scale documentation for more information about customizing color scheme.- detail : anyOf(FieldDef, List(FieldDef))
Additional levels of detail for grouping data in aggregate views and in line, trail, and area marks without mapping data to a specific visual channel.
- fill : anyOf(MarkPropFieldDefWithCondition, MarkPropValueDefWithCondition)
Fill color of the marks. Default value: If undefined, the default color depends on mark config ‘s
color
property.Note: When using
fill
channel,color
channel will be ignored. To customize both fill and stroke, please usefill
andstroke
channels (notfill
andcolor
).- href : anyOf(FieldDefWithCondition, ValueDefWithCondition)
A URL to load upon mouse click.
- key : FieldDef
A data field to use as a unique key for data binding. When a visualization’s data is updated, the key value will be used to match data elements to existing mark instances. Use a key channel to enable object constancy for transitions over dynamic data.
- latitude : FieldDef
Latitude position of geographically projected marks.
- latitude2 : FieldDef
Latitude-2 position for geographically projected ranged
"area"
,"bar"
,"rect"
, and"rule"
.- longitude : FieldDef
Longitude position of geographically projected marks.
- longitude2 : FieldDef
Longitude-2 position for geographically projected ranged
"area"
,"bar"
,"rect"
, and"rule"
.- opacity : anyOf(MarkPropFieldDefWithCondition, MarkPropValueDefWithCondition)
Opacity of the marks – either can be a value or a range.
Default value: If undefined, the default opacity depends on mark config ‘s
opacity
property.- order : anyOf(OrderFieldDef, List(OrderFieldDef), ValueDef)
Order of the marks.
- For stacked marks, this
order
channel encodes stack order. - For line and trail marks, this
order
channel encodes order of data points in the lines. This can be useful for creating a connected scatterplot. Settingorder
to{"value": null}
makes the line marks use the original order in the data sources. - Otherwise, this
order
channel encodes layer order of the marks.
Note : In aggregate plots,
order
field should beaggregate
d to avoid creating additional aggregation grouping.- For stacked marks, this
- shape : anyOf(MarkPropFieldDefWithCondition, MarkPropValueDefWithCondition)
For
point
marks the supported values are"circle"
(default),"square"
,"cross"
,"diamond"
,"triangle-up"
, or"triangle-down"
, or else a custom SVG path string. Forgeoshape
marks it should be a field definition of the geojson dataDefault value: If undefined, the default shape depends on mark config ‘s
shape
property.- size : anyOf(MarkPropFieldDefWithCondition, MarkPropValueDefWithCondition)
Size of the mark.
- For
"point"
,"square"
and"circle"
, – the symbol size, or pixel area of the mark. - For
"bar"
and"tick"
– the bar and tick’s size. - For
"text"
– the text’s font size. - Size is unsupported for
"line"
,"area"
, and"rect"
. (Use"trail"
instead of line with varying size)
- For
- stroke : anyOf(MarkPropFieldDefWithCondition, MarkPropValueDefWithCondition)
Stroke color of the marks. Default value: If undefined, the default color depends on mark config ‘s
color
property.Note: When using
stroke
channel,color
channel will be ignored. To customize both stroke and fill, please usestroke
andfill
channels (notstroke
andcolor
).- text : anyOf(TextFieldDefWithCondition, TextValueDefWithCondition)
Text of the
text
mark.- tooltip : anyOf(TextFieldDefWithCondition, TextValueDefWithCondition, List(TextFieldDef))
The tooltip text to show upon mouse hover.
- x : anyOf(PositionFieldDef, ValueDef)
X coordinates of the marks, or width of horizontal
"bar"
and"area"
.- x2 : anyOf(FieldDef, ValueDef)
X2 coordinates for ranged
"area"
,"bar"
,"rect"
, and"rule"
.- y : anyOf(PositionFieldDef, ValueDef)
Y coordinates of the marks, or height of vertical
"bar"
and"area"
.- y2 : anyOf(FieldDef, ValueDef)
Y2 coordinates for ranged
"area"
,"bar"
,"rect"
, and"rule"
.
-
class
altair.
EncodingSortField
(op=Undefined, field=Undefined, order=Undefined, **kwds)¶ EncodingSortField schema wrapper
Mapping(required=[op]) A sort definition for sorting a discrete scale in an encoding field definition.
Attributes: - op : AggregateOp
An aggregate operation to perform on the field prior to sorting (e.g.,
"count"
,"mean"
and"median"
). This property is required in cases where the sort field and the data reference field do not match. The input data objects will be aggregated, grouped by the encoded data field.For a full list of operations, please see the documentation for aggregate.
- field : anyOf(string, RepeatRef)
The data field to sort by.
Default value: If unspecified, defaults to the field specified in the outer data reference.
- order : SortOrder
The sort order. One of
"ascending"
(default),"descending"
, ornull
(no not sort).
-
class
altair.
EncodingWithFacet
(color=Undefined, column=Undefined, detail=Undefined, fill=Undefined, href=Undefined, key=Undefined, latitude=Undefined, latitude2=Undefined, longitude=Undefined, longitude2=Undefined, opacity=Undefined, order=Undefined, row=Undefined, shape=Undefined, size=Undefined, stroke=Undefined, text=Undefined, tooltip=Undefined, x=Undefined, x2=Undefined, y=Undefined, y2=Undefined, **kwds)¶ EncodingWithFacet schema wrapper
Mapping(required=[])
Attributes: - color : anyOf(MarkPropFieldDefWithCondition, MarkPropValueDefWithCondition)
Color of the marks – either fill or stroke color based on the
filled
property of mark definition. By default,color
represents fill color for"area"
,"bar"
,"tick"
,"text"
,"trail"
,"circle"
, and"square"
/ stroke color for"line"
and"point"
.Default value: If undefined, the default color depends on mark config ‘s
color
property.Note: 1) For fine-grained control over both fill and stroke colors of the marks, please use the
fill
andstroke
channels. If eitherfill
orstroke
channel is specified,color
channel will be ignored. 2) See the scale documentation for more information about customizing color scheme.- column : FacetFieldDef
Horizontal facets for trellis plots.
- detail : anyOf(FieldDef, List(FieldDef))
Additional levels of detail for grouping data in aggregate views and in line, trail, and area marks without mapping data to a specific visual channel.
- fill : anyOf(MarkPropFieldDefWithCondition, MarkPropValueDefWithCondition)
Fill color of the marks. Default value: If undefined, the default color depends on mark config ‘s
color
property.Note: When using
fill
channel,color
channel will be ignored. To customize both fill and stroke, please usefill
andstroke
channels (notfill
andcolor
).- href : anyOf(FieldDefWithCondition, ValueDefWithCondition)
A URL to load upon mouse click.
- key : FieldDef
A data field to use as a unique key for data binding. When a visualization’s data is updated, the key value will be used to match data elements to existing mark instances. Use a key channel to enable object constancy for transitions over dynamic data.
- latitude : FieldDef
Latitude position of geographically projected marks.
- latitude2 : FieldDef
Latitude-2 position for geographically projected ranged
"area"
,"bar"
,"rect"
, and"rule"
.- longitude : FieldDef
Longitude position of geographically projected marks.
- longitude2 : FieldDef
Longitude-2 position for geographically projected ranged
"area"
,"bar"
,"rect"
, and"rule"
.- opacity : anyOf(MarkPropFieldDefWithCondition, MarkPropValueDefWithCondition)
Opacity of the marks – either can be a value or a range.
Default value: If undefined, the default opacity depends on mark config ‘s
opacity
property.- order : anyOf(OrderFieldDef, List(OrderFieldDef), ValueDef)
Order of the marks.
- For stacked marks, this
order
channel encodes stack order. - For line and trail marks, this
order
channel encodes order of data points in the lines. This can be useful for creating a connected scatterplot. Settingorder
to{"value": null}
makes the line marks use the original order in the data sources. - Otherwise, this
order
channel encodes layer order of the marks.
Note : In aggregate plots,
order
field should beaggregate
d to avoid creating additional aggregation grouping.- For stacked marks, this
- row : FacetFieldDef
Vertical facets for trellis plots.
- shape : anyOf(MarkPropFieldDefWithCondition, MarkPropValueDefWithCondition)
For
point
marks the supported values are"circle"
(default),"square"
,"cross"
,"diamond"
,"triangle-up"
, or"triangle-down"
, or else a custom SVG path string. Forgeoshape
marks it should be a field definition of the geojson dataDefault value: If undefined, the default shape depends on mark config ‘s
shape
property.- size : anyOf(MarkPropFieldDefWithCondition, MarkPropValueDefWithCondition)
Size of the mark.
- For
"point"
,"square"
and"circle"
, – the symbol size, or pixel area of the mark. - For
"bar"
and"tick"
– the bar and tick’s size. - For
"text"
– the text’s font size. - Size is unsupported for
"line"
,"area"
, and"rect"
. (Use"trail"
instead of line with varying size)
- For
- stroke : anyOf(MarkPropFieldDefWithCondition, MarkPropValueDefWithCondition)
Stroke color of the marks. Default value: If undefined, the default color depends on mark config ‘s
color
property.Note: When using
stroke
channel,color
channel will be ignored. To customize both stroke and fill, please usestroke
andfill
channels (notstroke
andcolor
).- text : anyOf(TextFieldDefWithCondition, TextValueDefWithCondition)
Text of the
text
mark.- tooltip : anyOf(TextFieldDefWithCondition, TextValueDefWithCondition, List(TextFieldDef))
The tooltip text to show upon mouse hover.
- x : anyOf(PositionFieldDef, ValueDef)
X coordinates of the marks, or width of horizontal
"bar"
and"area"
.- x2 : anyOf(FieldDef, ValueDef)
X2 coordinates for ranged
"area"
,"bar"
,"rect"
, and"rule"
.- y : anyOf(PositionFieldDef, ValueDef)
Y coordinates of the marks, or height of vertical
"bar"
and"area"
.- y2 : anyOf(FieldDef, ValueDef)
Y2 coordinates for ranged
"area"
,"bar"
,"rect"
, and"rule"
.
-
class
altair.
FacetFieldDef
(type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, header=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, **kwds)¶ FacetFieldDef schema wrapper
Mapping(required=[type])Attributes: - type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- header : Header
An object defining properties of a facet’s header.
- <<<<<<< HEAD
- sort : SortOrder
Sort order for a facet field. This can be
"ascending"
,"descending"
.
- =======
- sort : 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"
– forsorting by the values’ natural order in Javascript. * `A sort field definition
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`_ for sorting by another field. * An array specifying the field values in preferred order. In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). *null
indicating no sort. Default value:"ascending"
Note:null
is not supported forrow
andcolumn
.
- >>>>>>> altair-viz/master
- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.
-
class
altair.
FacetMapping
(column=Undefined, row=Undefined, **kwds)¶ FacetMapping schema wrapper
Mapping(required=[])
Attributes: - column : FacetFieldDef
Horizontal facets for trellis plots.
- row : FacetFieldDef
Vertical facets for trellis plots.
-
to_dict
(*args, **kwargs)¶ Return a dictionary representation of the object
Parameters: - validate : boolean or string
If True (default), then validate the output dictionary against the schema. If “deep” then recursively validate all objects in the spec. This takes much more time, but it results in friendlier tracebacks for large objects.
- ignore : list
A list of keys to ignore. This will not passed to child to_dict function calls.
- context : dict (optional)
A context dictionary that will be passed to all child to_dict function calls
Returns: - dct : dictionary
The dictionary representation of this object
Raises: - jsonschema.ValidationError :
if validate=True and the dict does not conform to the schema
-
class
altair.
FacetSpec
(facet=Undefined, spec=Undefined, align=Undefined, bounds=Undefined, center=Undefined, data=Undefined, description=Undefined, name=Undefined, resolve=Undefined, spacing=Undefined, title=Undefined, transform=Undefined, **kwds)¶ FacetSpec schema wrapper
Mapping(required=[facet, spec])
Attributes: - facet : FacetMapping
An object that describes mappings between
row
andcolumn
channels and their field definitions.- spec : anyOf(LayerSpec, CompositeUnitSpec)
A specification of the view that gets faceted.
- align : anyOf(VgLayoutAlign, RowColVgLayoutAlign)
The alignment to apply to grid rows and columns. 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. Alternatively, an object value of the form{"row": string, "column": string}
canbe used to supply different alignments for rows and columns. Default value:
"all"
.- bounds : enum(‘full’, ‘flush’)
The bounds calculation method to use for determining the extent of a sub-plot. One of
full
(the default) orflush
. * If set tofull
, the entire calculated bounds (including axes, title, and legend) will be used. * If set toflush
, only the specified width and height values for the sub-view will be used.The
flush
setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. Default value:"full"
- center : anyOf(boolean, RowColboolean)
Boolean flag indicating if subviews should be centered relative to their respective rows or columns. An object value of the form
{"row": boolean, "column": boolean}
can be used to supply different centering values for rows and columns. Default value:false
- data : Data
An object describing the data source
- description : string
Description of this mark for commenting purpose.
- name : string
Name of the visualization for later reference.
- resolve : Resolve
Scale, axis, and legend resolutions for facets.
- spacing : anyOf(float, RowColnumber)
The spacing in pixels between sub-views of the composition operator. An object of the form
{"row": number, "column": number}
can be used to set different spacing values for rows and columns. Default value :10
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
-
class
altair.
FacetedCompositeUnitSpecAlias
(mark=Undefined, data=Undefined, description=Undefined, encoding=Undefined, height=Undefined, name=Undefined, projection=Undefined, selection=Undefined, title=Undefined, transform=Undefined, width=Undefined, **kwds)¶ FacetedCompositeUnitSpecAlias schema wrapper
Mapping(required=[mark])
Attributes: - mark : AnyMark
A string describing the mark type (one of
"bar"
,"circle"
,"square"
,"tick"
,"line"
,"area"
,"point"
,"rule"
,"geoshape"
, and"text"
) or a mark definition object.- data : Data
An object describing the data source
- description : string
Description of this mark for commenting purpose.
- encoding : EncodingWithFacet
A key-value mapping between encoding channels and definition of fields.
- height : float
The height of a visualization.
Default value:
- If a view’s autosize
type is
"fit"
or its y-channel has a continuous scale, the height will be the value of config.view.height. - For y-axis with a band or point scale: if rangeStep is a numeric value or
unspecified, the height is determined by the range step, paddings, and the
cardinality of the field mapped to y-channel. Otherwise, if the
rangeStep
isnull
, the height will be the value of config.view.height. - If no field is mapped to
y
channel, theheight
will be the value ofrangeStep
.
Note : For plots with row and column channels, this represents the height of a single view.
See also: The documentation for width and height contains more examples.
- If a view’s autosize
type is
- name : string
Name of the visualization for later reference.
- projection : Projection
An object defining properties of geographic projection, which will be applied to
shape
path for"geoshape"
marks and tolatitude
and"longitude"
channels for other marks.- selection : Mapping(required=[])
A key-value mapping between selection names and definitions.
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- width : float
The width of a visualization.
Default value: This will be determined by the following rules:
- If a view’s autosize
type is
"fit"
or its x-channel has a continuous scale, the width will be the value of config.view.width. - For x-axis with a band or point scale: if rangeStep is a numeric value or
unspecified, the width is determined by the range step, paddings, and the
cardinality of the field mapped to x-channel. Otherwise, if the
rangeStep
isnull
, the width will be the value of config.view.width. - If no field is mapped to
x
channel, thewidth
will be the value of config.scale.textXRangeStep fortext
mark and the value ofrangeStep
for other marks.
Note: For plots with row and column channels, this represents the width of a single view.
See also: The documentation for width and height contains more examples.
- If a view’s autosize
type is
-
class
altair.
FieldDef
(type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, **kwds)¶ FieldDef schema wrapper
Mapping(required=[type]) Definition object for a data field, its type and transformation of an encoding channel.
Attributes: - type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.
-
class
altair.
FieldDefWithCondition
(type=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, **kwds)¶ FieldDefWithCondition schema wrapper
Mapping(required=[type]) A FieldDef with Condition
Attributes: - type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.
-
class
altair.
FieldEqualPredicate
(equal=Undefined, field=Undefined, timeUnit=Undefined, **kwds)¶ FieldEqualPredicate schema wrapper
Mapping(required=[equal, field])
Attributes: - equal : anyOf(string, float, boolean, DateTime)
The value that the field should be equal to.
- field : string
Field to be filtered.
- timeUnit : TimeUnit
Time unit for the field to be filtered.
-
class
altair.
FieldGTEPredicate
(field=Undefined, gte=Undefined, timeUnit=Undefined, **kwds)¶ FieldGTEPredicate schema wrapper
Mapping(required=[field, gte])
Attributes: - field : string
Field to be filtered.
- gte : anyOf(string, float, DateTime)
The value that the field should be greater than or equals to.
- timeUnit : TimeUnit
Time unit for the field to be filtered.
-
class
altair.
FieldGTPredicate
(field=Undefined, gt=Undefined, timeUnit=Undefined, **kwds)¶ FieldGTPredicate schema wrapper
Mapping(required=[field, gt])
Attributes: - field : string
Field to be filtered.
- gt : anyOf(string, float, DateTime)
The value that the field should be greater than.
- timeUnit : TimeUnit
Time unit for the field to be filtered.
-
class
altair.
FieldLTEPredicate
(field=Undefined, lte=Undefined, timeUnit=Undefined, **kwds)¶ FieldLTEPredicate schema wrapper
Mapping(required=[field, lte])
Attributes: - field : string
Field to be filtered.
- lte : anyOf(string, float, DateTime)
The value that the field should be less than or equals to.
- timeUnit : TimeUnit
Time unit for the field to be filtered.
-
class
altair.
FieldLTPredicate
(field=Undefined, lt=Undefined, timeUnit=Undefined, **kwds)¶ FieldLTPredicate schema wrapper
Mapping(required=[field, lt])
Attributes: - field : string
Field to be filtered.
- lt : anyOf(string, float, DateTime)
The value that the field should be less than.
- timeUnit : TimeUnit
Time unit for the field to be filtered.
-
class
altair.
FieldOneOfPredicate
(field=Undefined, oneOf=Undefined, timeUnit=Undefined, **kwds)¶ FieldOneOfPredicate schema wrapper
Mapping(required=[field, oneOf])
Attributes: - field : string
Field to be filtered.
- oneOf : anyOf(List(string), List(float), List(boolean), List(DateTime))
A set of values that the
field
‘s value should be a member of, for a data item included in the filtered data.- timeUnit : TimeUnit
Time unit for the field to be filtered.
-
class
altair.
FieldRangePredicate
(field=Undefined, range=Undefined, timeUnit=Undefined, **kwds)¶ FieldRangePredicate schema wrapper
Mapping(required=[field, range])
Attributes: - field : string
Field to be filtered.
- range : List(anyOf(float, DateTime, None))
An array of inclusive minimum and maximum values for a field value of a data item to be included in the filtered data.
- timeUnit : TimeUnit
Time unit for the field to be filtered.
-
class
altair.
Fill
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Fill schema wrapper
Mapping(required=[shorthand]) A FieldDef with Condition
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- legend : anyOf(Legend, None)
An object defining properties of the legend. If
null
, the legend for the encoding channel will be removed.Default value: If undefined, default legend properties are applied.
- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
FillValue
(value, condition=Undefined, **kwds)¶ FillValue schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalMarkPropFieldDef, ConditionalValueDef,
- List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
FilterTransform
(filter=Undefined, **kwds)¶ FilterTransform schema wrapper
Mapping(required=[filter])
Attributes: - filter : LogicalOperandPredicate
The
filter
property must be one of the predicate definitions:1) an expression string, where
datum
can be used to refer to the current data object2) one of the field predicates: equal, lt, lte, gt, gte, range, or oneOf.
3) a selection predicate
- a logical operand that combines (1), (2), or (3).
-
class
altair.
FontStyle
(*args)¶ FontStyle schema wrapper
enum(‘normal’, ‘italic’)
-
class
altair.
FontWeight
(*args, **kwds)¶ FontWeight schema wrapper
anyOf(FontWeightString, FontWeightNumber)
-
class
altair.
FontWeightNumber
(*args)¶ FontWeightNumber schema wrapper
float
-
class
altair.
FontWeightString
(*args)¶ FontWeightString schema wrapper
enum(‘normal’, ‘bold’)
-
class
altair.
GeoType
(*args)¶ GeoType schema wrapper
enum(‘latitude’, ‘longitude’, ‘geojson’)
-
class
altair.
HConcatChart
(data=Undefined, hconcat=(), **kwargs) - A chart with horizontally-concatenated facets
- Mapping(required=[hconcat])
Attributes: - hconcat : List(Spec)
A list of views that should be concatenated and put into a row.
- autosize : anyOf(AutosizeType, AutoSizeParams)
Sets how the visualization size should be determined. If a string, should be one of
"pad"
,"fit"
or"none"
. Object values can additionally specify parameters for content sizing and automatic resizing."fit"
is only supported for single and layered views that don’t userangeStep
.Default value :
pad
background : string
- <<<<<<< HEAD
CSS color property to use as the background of visualization.
Default value: none (transparent)
- =======
CSS color property to use as the background of visualization. Default value: none (transparent)
- bounds : enum(‘full’, ‘flush’)
The bounds calculation method to use for determining the extent of a sub-plot. One of
full
(the default) orflush
. * If set tofull
, the entire calculated bounds (including axes, title, and legend) will be used. * If set toflush
, only the specified width and height values for the sub-view will be used.The
flush
setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. Default value:"full"
- center : boolean
Boolean flag indicating if subviews should be centered relative to their respective rows or columns. Default value:
false
- >>>>>>> altair-viz/master
- config : Config
Vega-Lite configuration object. This property can only be defined at the top-level of a specification.
- data : Data
An object describing the data source
- datasets : Datasets
A global data store for named datasets. This is a mapping from names to inline datasets. This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a
data
property.- description : string
Description of this mark for commenting purpose.
- name : string
Name of the visualization for later reference.
- padding : Padding
The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format
{"left": 5, "top": 5, "right": 5, "bottom": 5}
to specify padding for each side of the visualization.Default value :
5
- resolve : Resolve
Scale, axis, and legend resolutions for horizontally concatenated charts.
- spacing : float
- The spacing in pixels between sub-views of the concat operator. Default value :
10
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- $schema : string
URL to JSON schema for a Vega-Lite specification. Unless you have a reason to change this, use
https://vega.github.io/schema/vega-lite/v2.json
. Setting the$schema
property allows automatic validation and autocomplete in editors that support JSON schema.
-
class
altair.
HConcatSpec
(hconcat=Undefined, bounds=Undefined, center=Undefined, data=Undefined, description=Undefined, name=Undefined, resolve=Undefined, spacing=Undefined, title=Undefined, transform=Undefined, **kwds)¶ HConcatSpec schema wrapper
Mapping(required=[hconcat])
Attributes: - hconcat : List(Spec)
A list of views that should be concatenated and put into a row.
- bounds : enum(‘full’, ‘flush’)
The bounds calculation method to use for determining the extent of a sub-plot. One of
full
(the default) orflush
. * If set tofull
, the entire calculated bounds (including axes, title, and legend) will be used. * If set toflush
, only the specified width and height values for the sub-view will be used.The
flush
setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. Default value:"full"
- center : boolean
Boolean flag indicating if subviews should be centered relative to their respective rows or columns. Default value:
false
- data : Data
An object describing the data source
- description : string
Description of this mark for commenting purpose.
- name : string
Name of the visualization for later reference.
- resolve : Resolve
Scale, axis, and legend resolutions for horizontally concatenated charts.
- spacing : float
- The spacing in pixels between sub-views of the concat operator. Default value :
10
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
-
class
altair.
Header
(format=Undefined, labelAngle=Undefined, labelColor=Undefined, labelFont=Undefined, labelFontSize=Undefined, labelLimit=Undefined, title=Undefined, titleAnchor=Undefined, titleAngle=Undefined, titleBaseline=Undefined, titleColor=Undefined, titleFont=Undefined, titleFontSize=Undefined, titleFontWeight=Undefined, titleLimit=Undefined, **kwds)¶ Header schema wrapper
Mapping(required=[]) Headers of row / column channels for faceted plots.
Attributes: - format : string
The formatting pattern for labels. This is D3’s number format pattern for quantitative fields and D3’s time format pattern for time field.
See the format documentation for more information.
Default value: derived from numberFormat config for quantitative fields and from timeFormat config for temporal fields.
- labelAngle : float
The rotation angle of the header labels. Default value:
0
.- labelColor : string
The color of the header label, can be in hex color code or regular color name.
- labelFont : string
The font of the header label.
- labelFontSize : float
The font size of the header label, in pixels.
- labelLimit : float
The maximum length of the header label in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. Default value:
0
, indicating no limit- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed. Default value: derived from the field’s name and transformation function (aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name. Notes : 1) You can customize the default field titleformat by providing the [
fieldTitle
property in the `config<https://vega.github.io/vega-lite/docs/config.html>`_ or `
fieldTitle
function via thecompile
function’s options <https://vega.github.io/vega-lite/docs/compile.html#field-title>`_. 2) If both field definition’stitle
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- titleAnchor : string
The anchor position for placing the title. One of
"start"
,"middle"
, or"end"
. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title. Default value:"middle"
for `single<https://vega.github.io/vega-lite/docs/spec.html>`_ and `layered
<https://vega.github.io/vega-lite/docs/layer.html>`_ views.
"start"
for other composite views. Note: For now,anchor
is only customizable only for single and layered views. For other composite views,anchor
is always"start"
.- titleAngle : float
The rotation angle of the header title. Default value:
0
.- titleBaseline : TextBaseline
Vertical text baseline for the header title. One of
"top"
,"bottom"
,"middle"
. Default value:"middle"
- titleColor : string
Color of the header title, can be in hex color code or regular color name.
- titleFont : string
Font of the header title. (e.g.,
"Helvetica Neue"
).- titleFontSize : float
Font size of the header title.
- titleFontWeight : FontWeight
Font weight of the header title. This can be either a string (e.g
"bold"
,"normal"
) or a number (100
,200
,300
, …,900
where"normal"
=400
and"bold"
=700
).- titleLimit : float
The maximum length of the header title in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. Default value:
0
, indicating no limit
-
class
altair.
HeaderConfig
(labelAngle=Undefined, labelColor=Undefined, labelFont=Undefined, labelFontSize=Undefined, labelLimit=Undefined, titleAnchor=Undefined, titleAngle=Undefined, titleBaseline=Undefined, titleColor=Undefined, titleFont=Undefined, titleFontSize=Undefined, titleFontWeight=Undefined, titleLimit=Undefined, **kwds)¶ HeaderConfig schema wrapper
Mapping(required=[])
Attributes: - labelAngle : float
The rotation angle of the header labels. Default value:
0
.- labelColor : string
The color of the header label, can be in hex color code or regular color name.
- labelFont : string
The font of the header label.
- labelFontSize : float
The font size of the header label, in pixels.
- labelLimit : float
The maximum length of the header label in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. Default value:
0
, indicating no limit- titleAnchor : string
The anchor position for placing the title. One of
"start"
,"middle"
, or"end"
. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title. Default value:"middle"
for `single<https://vega.github.io/vega-lite/docs/spec.html>`_ and `layered
<https://vega.github.io/vega-lite/docs/layer.html>`_ views.
"start"
for other composite views. Note: For now,anchor
is only customizable only for single and layered views. For other composite views,anchor
is always"start"
.- titleAngle : float
The rotation angle of the header title. Default value:
0
.- titleBaseline : TextBaseline
Vertical text baseline for the header title. One of
"top"
,"bottom"
,"middle"
. Default value:"middle"
- titleColor : string
Color of the header title, can be in hex color code or regular color name.
- titleFont : string
Font of the header title. (e.g.,
"Helvetica Neue"
).- titleFontSize : float
Font size of the header title.
- titleFontWeight : FontWeight
Font weight of the header title. This can be either a string (e.g
"bold"
,"normal"
) or a number (100
,200
,300
, …,900
where"normal"
=400
and"bold"
=700
).- titleLimit : float
The maximum length of the header title in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. Default value:
0
, indicating no limit
-
class
altair.
HorizontalAlign
(*args)¶ HorizontalAlign schema wrapper
enum(‘left’, ‘right’, ‘center’)
-
class
altair.
Href
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds) Href schema wrapper
Mapping(required=[shorthand]) A FieldDef with Condition
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
HrefValue
(value, condition=Undefined, **kwds) HrefValue schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalFieldDef, ConditionalValueDef, List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
InlineData
(values=Undefined, format=Undefined, name=Undefined, **kwds)¶ InlineData schema wrapper
Mapping(required=[values])
Attributes: - values : InlineDataset
The full data set, included inline. This can be an array of objects or primitive values, an object, or a string. Arrays of primitive values are ingested as objects with a
data
property. Strings are parsed according to the specified format type.- format : DataFormat
An object that specifies the format for parsing the data.
- name : string
Provide a placeholder name and bind data at runtime.
-
class
altair.
InlineDataset
(*args, **kwds)¶ InlineDataset schema wrapper
anyOf(List(float), List(string), List(boolean), List(Mapping(required=[])), string, Mapping(required=[]))
-
class
altair.
Interpolate
(*args)¶ Interpolate schema wrapper
enum(‘linear’, ‘linear-closed’, ‘step’, ‘step-before’, ‘step-after’, ‘basis’, ‘basis-open’, ‘basis-closed’, ‘cardinal’, ‘cardinal-open’, ‘cardinal-closed’, ‘bundle’, ‘monotone’)
-
class
altair.
IntervalSelection
(type=Undefined, bind=Undefined, empty=Undefined, encodings=Undefined, fields=Undefined, mark=Undefined, on=Undefined, resolve=Undefined, translate=Undefined, zoom=Undefined, **kwds)¶ IntervalSelection schema wrapper
Mapping(required=[type])
Attributes: - type : enum(‘interval’)
- bind : enum(‘scales’)
Establishes a two-way binding between the interval selection and the scales used within the same view. This allows a user to interactively pan and zoom the view.
- empty : enum(‘all’, ‘none’)
By default, all data values are considered to lie within an empty selection. When set to
none
, empty selections contain no data values.- encodings : List(SingleDefChannel)
An array of encoding channels. The corresponding data field values must match for a data tuple to fall within the selection.
- fields : List(string)
An array of field names whose values must match for a data tuple to fall within the selection.
- mark : BrushConfig
An interval selection also adds a rectangle mark to depict the extents of the interval. The
mark
property can be used to customize the appearance of the mark.- on : VgEventStream
A Vega event stream (object or selector) that triggers the selection. For interval selections, the event stream must specify a start and end.
- resolve : SelectionResolution
With layered and multi-view displays, a strategy that determines how selections’ data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain.
- translate : anyOf(string, boolean)
When truthy, allows a user to interactively move an interval selection back-and-forth. Can be
true
,false
(to disable panning), or a Vega event stream definition which must include a start and end event to trigger continuous panning.Default value:
true
, which corresponds to[mousedown, window:mouseup] > window:mousemove!
which corresponds to clicks and dragging within an interval selection to reposition it.- zoom : anyOf(string, boolean)
When truthy, allows a user to interactively resize an interval selection. Can be
true
,false
(to disable zooming), or a Vega event stream definition. Currently, onlywheel
events are supported.Default value:
true
, which corresponds towheel!
.
-
class
altair.
IntervalSelectionConfig
(bind=Undefined, empty=Undefined, encodings=Undefined, fields=Undefined, mark=Undefined, on=Undefined, resolve=Undefined, translate=Undefined, zoom=Undefined, **kwds)¶ IntervalSelectionConfig schema wrapper
Mapping(required=[])
Attributes: - bind : enum(‘scales’)
Establishes a two-way binding between the interval selection and the scales used within the same view. This allows a user to interactively pan and zoom the view.
- empty : enum(‘all’, ‘none’)
By default, all data values are considered to lie within an empty selection. When set to
none
, empty selections contain no data values.- encodings : List(SingleDefChannel)
An array of encoding channels. The corresponding data field values must match for a data tuple to fall within the selection.
- fields : List(string)
An array of field names whose values must match for a data tuple to fall within the selection.
- mark : BrushConfig
An interval selection also adds a rectangle mark to depict the extents of the interval. The
mark
property can be used to customize the appearance of the mark.- on : VgEventStream
A Vega event stream (object or selector) that triggers the selection. For interval selections, the event stream must specify a start and end.
- resolve : SelectionResolution
With layered and multi-view displays, a strategy that determines how selections’ data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain.
- translate : anyOf(string, boolean)
When truthy, allows a user to interactively move an interval selection back-and-forth. Can be
true
,false
(to disable panning), or a Vega event stream definition which must include a start and end event to trigger continuous panning.Default value:
true
, which corresponds to[mousedown, window:mouseup] > window:mousemove!
which corresponds to clicks and dragging within an interval selection to reposition it.- zoom : anyOf(string, boolean)
When truthy, allows a user to interactively resize an interval selection. Can be
true
,false
(to disable zooming), or a Vega event stream definition. Currently, onlywheel
events are supported.Default value:
true
, which corresponds towheel!
.
-
class
altair.
JsonDataFormat
(parse=Undefined, property=Undefined, type=Undefined, **kwds)¶ JsonDataFormat schema wrapper
Mapping(required=[])
Attributes: - parse : anyOf(enum(‘auto’), Parse, None)
If set to
"auto"
(the default), perform automatic type inference to determine the desired data types. If set tonull
, disable type inference based on the spec and only use type inference based on the data. Alternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of"number"
,"boolean"
,"date"
, or null (do not parse the field)). For example,"parse": {"modified_on": "date"}
parses themodified_on
field in each input record a Date value.For
"date"
, we parse data based using Javascript’s Date.parse(). For Specific date formats can be provided (e.g.,{foo: 'date:"%m%d%Y"'}
), using the d3-time-format syntax. UTC date format parsing is supported similarly (e.g.,{foo: 'utc:"%m%d%Y"'}
). See more about UTC time- property : string
The JSON property containing the desired data. This parameter can be used when the loaded JSON file may have surrounding structure or meta-data. For example
"property": "values.features"
is equivalent to retrievingjson.values.features
from the loaded JSON object.- type : enum(‘json’)
Type of input data:
"json"
,"csv"
,"tsv"
,"dsv"
. The default format type is determined by the extension of the file URL. If no extension is detected,"json"
will be used by default.
-
class
altair.
Key
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Key schema wrapper
Mapping(required=[shorthand]) Definition object for a data field, its type and transformation of an encoding channel.
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
Latitude
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Latitude schema wrapper
Mapping(required=[shorthand]) Definition object for a data field, its type and transformation of an encoding channel.
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
Latitude2
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Latitude2 schema wrapper
Mapping(required=[shorthand]) Definition object for a data field, its type and transformation of an encoding channel.
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
LayerSpec
(layer=Undefined, data=Undefined, description=Undefined, encoding=Undefined, height=Undefined, name=Undefined, projection=Undefined, resolve=Undefined, title=Undefined, transform=Undefined, width=Undefined, **kwds)¶ LayerSpec schema wrapper
Mapping(required=[layer]) Layer Spec with encoding and projection
Attributes: - layer : List(anyOf(LayerSpec, CompositeUnitSpec))
Layer or single view specifications to be layered.
Note : Specifications inside
layer
cannot userow
andcolumn
channels as layering facet specifications is not allowed.- data : Data
An object describing the data source
- description : string
Description of this mark for commenting purpose.
- encoding : Encoding
A shared key-value mapping between encoding channels and definition of fields in the underlying layers.
- height : float
The height of a visualization.
Default value:
- If a view’s autosize
type is
"fit"
or its y-channel has a continuous scale, the height will be the value of config.view.height. - For y-axis with a band or point scale: if rangeStep is a numeric value or
unspecified, the height is determined by the range step, paddings, and the
cardinality of the field mapped to y-channel. Otherwise, if the
rangeStep
isnull
, the height will be the value of config.view.height. - If no field is mapped to
y
channel, theheight
will be the value ofrangeStep
.
Note : For plots with row and column channels, this represents the height of a single view.
See also: The documentation for width and height contains more examples.
- If a view’s autosize
type is
- name : string
Name of the visualization for later reference.
- projection : Projection
An object defining properties of the geographic projection shared by underlying layers.
- resolve : Resolve
Scale, axis, and legend resolutions for layers.
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- width : float
The width of a visualization.
Default value: This will be determined by the following rules:
- If a view’s autosize
type is
"fit"
or its x-channel has a continuous scale, the width will be the value of config.view.width. - For x-axis with a band or point scale: if rangeStep is a numeric value or
unspecified, the width is determined by the range step, paddings, and the
cardinality of the field mapped to x-channel. Otherwise, if the
rangeStep
isnull
, the width will be the value of config.view.width. - If no field is mapped to
x
channel, thewidth
will be the value of config.scale.textXRangeStep fortext
mark and the value ofrangeStep
for other marks.
Note: For plots with row and column channels, this represents the width of a single view.
See also: The documentation for width and height contains more examples.
- If a view’s autosize
type is
-
class
altair.
Legend
(entryPadding=Undefined, format=Undefined, offset=Undefined, orient=Undefined, padding=Undefined, tickCount=Undefined, title=Undefined, type=Undefined, values=Undefined, zindex=Undefined, **kwds)¶ Legend schema wrapper
Mapping(required=[]) Properties of a legend or boolean flag for determining whether to show it.Attributes: - entryPadding : float
Padding (in pixels) between legend entries in a symbol legend.
- format : string
The formatting pattern for labels. This is D3’s number format pattern for quantitative fields and D3’s time format pattern for time field.
See the format documentation for more information.
Default value: derived from numberFormat config for quantitative fields and from timeFormat config for temporal fields.
- offset : float
The offset, in pixels, by which to displace the legend from the edge of the enclosing group or data rectangle.
Default value:
0
- orient : LegendOrient
The orientation of the legend, which determines how the legend is positioned within the scene. One of “left”, “right”, “top-left”, “top-right”, “bottom-left”, “bottom-right”, “none”.
Default value:
"right"
- padding : float
The padding, in pixels, between the legend and axis.
- tickCount : float
The desired number of tick values for quantitative legends.
- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : enum(‘symbol’, ‘gradient’)
The type of the legend. Use
"symbol"
to create a discrete legend and
- <<<<<<< HEAD
"gradient"
for a continuous color gradient.Default value:
"gradient"
for non-binned quantitative fields and temporal fields;"symbol"
otherwise.values : anyOf(List(float), List(string), List(DateTime))
- =======
"gradient"
for a continuous color gradient. Default value:"gradient"
for non-binned quantitative fields and temporal fields;"symbol"
otherwise.values : anyOf(List(float), List(string), List(boolean), List(DateTime))
- >>>>>>> altair-viz/master
Explicitly set the visible legend values.
- zindex : float
A non-positive integer indicating z-index of the legend. If zindex is 0, legend should be drawn behind all chart elements. To put them in front, use zindex = 1.
-
class
altair.
LegendConfig
(cornerRadius=Undefined, entryPadding=Undefined, fillColor=Undefined, gradientHeight=Undefined, gradientLabelBaseline=Undefined, gradientLabelLimit=Undefined, gradientLabelOffset=Undefined, gradientStrokeColor=Undefined, gradientStrokeWidth=Undefined, gradientWidth=Undefined, labelAlign=Undefined, labelBaseline=Undefined, labelColor=Undefined, labelFont=Undefined, labelFontSize=Undefined, labelLimit=Undefined, labelOffset=Undefined, offset=Undefined, orient=Undefined, padding=Undefined, shortTimeLabels=Undefined, strokeColor=Undefined, strokeDash=Undefined, strokeWidth=Undefined, symbolColor=Undefined, symbolSize=Undefined, symbolStrokeWidth=Undefined, symbolType=Undefined, titleAlign=Undefined, titleBaseline=Undefined, titleColor=Undefined, titleFont=Undefined, titleFontSize=Undefined, titleFontWeight=Undefined, titleLimit=Undefined, titlePadding=Undefined, **kwds)¶ LegendConfig schema wrapper
Mapping(required=[])
Attributes: - cornerRadius : float
Corner radius for the full legend.
- entryPadding : float
Padding (in pixels) between legend entries in a symbol legend.
- fillColor : string
Background fill color for the full legend.
- gradientHeight : float
The height of the gradient, in pixels.
- gradientLabelBaseline : string
Text baseline for color ramp gradient labels.
- gradientLabelLimit : float
The maximum allowed length in pixels of color ramp gradient labels.
- gradientLabelOffset : float
Vertical offset in pixels for color ramp gradient labels.
- gradientStrokeColor : string
The color of the gradient stroke, can be in hex color code or regular color name.
- gradientStrokeWidth : float
The width of the gradient stroke, in pixels.
- gradientWidth : float
The width of the gradient, in pixels.
- labelAlign : string
The alignment of the legend label, can be left, middle or right.
- labelBaseline : string
The position of the baseline of legend label, can be top, middle or bottom.
- labelColor : string
The color of the legend label, can be in hex color code or regular color name.
- labelFont : string
The font of the legend label.
- labelFontSize : float
The font size of legend label.
Default value:
10
.- labelLimit : float
Maximum allowed pixel width of axis tick labels.
- labelOffset : float
The offset of the legend label.
- offset : float
The offset, in pixels, by which to displace the legend from the edge of the enclosing group or data rectangle.
Default value:
0
- orient : LegendOrient
The orientation of the legend, which determines how the legend is positioned within the scene. One of “left”, “right”, “top-left”, “top-right”, “bottom-left”, “bottom-right”, “none”.
Default value:
"right"
- padding : float
The padding, in pixels, between the legend and axis.
- shortTimeLabels : boolean
Whether month names and weekday names should be abbreviated.
Default value:
false
- strokeColor : string
Border stroke color for the full legend.
- strokeDash : List(float)
Border stroke dash pattern for the full legend.
- strokeWidth : float
Border stroke width for the full legend.
- symbolColor : string
The color of the legend symbol,
- symbolSize : float
The size of the legend symbol, in pixels.
- symbolStrokeWidth : float
The width of the symbol’s stroke.
- symbolType : string
Default shape type (such as “circle”) for legend symbols.
- titleAlign : string
Horizontal text alignment for legend titles.
- titleBaseline : string
Vertical text baseline for legend titles.
- titleColor : string
The color of the legend title, can be in hex color code or regular color name.
- titleFont : string
The font of the legend title.
- titleFontSize : float
The font size of the legend title.
- titleFontWeight : FontWeight
The font weight of the legend title. This can be either a string (e.g
"bold"
,"normal"
) or a number (100
,200
,300
, …,900
where"normal"
=400
and"bold"
=700
).- titleLimit : float
Maximum allowed pixel width of axis titles.
- titlePadding : float
The padding, in pixels, between title and legend.
-
class
altair.
LegendOrient
(*args)¶ LegendOrient schema wrapper
enum(‘left’, ‘right’, ‘top-left’, ‘top-right’, ‘bottom-left’, ‘bottom-right’, ‘none’)
-
class
altair.
LegendResolveMap
(color=Undefined, fill=Undefined, opacity=Undefined, shape=Undefined, size=Undefined, stroke=Undefined, **kwds)¶ LegendResolveMap schema wrapper
Mapping(required=[])
Attributes: - color : ResolveMode
- fill : ResolveMode
- opacity : ResolveMode
- shape : ResolveMode
- size : ResolveMode
- stroke : ResolveMode
-
class
altair.
LineConfig
(align=Undefined, angle=Undefined, baseline=Undefined, color=Undefined, cornerRadius=Undefined, cursor=Undefined, dir=Undefined, dx=Undefined, dy=Undefined, ellipsis=Undefined, fill=Undefined, fillOpacity=Undefined, filled=Undefined, font=Undefined, fontSize=Undefined, fontStyle=Undefined, fontWeight=Undefined, href=Undefined, interpolate=Undefined, limit=Undefined, opacity=Undefined, orient=Undefined, point=Undefined, radius=Undefined, shape=Undefined, size=Undefined, stroke=Undefined, strokeCap=Undefined, strokeDash=Undefined, strokeDashOffset=Undefined, strokeJoin=Undefined, strokeMiterLimit=Undefined, strokeOpacity=Undefined, strokeWidth=Undefined, tension=Undefined, text=Undefined, theta=Undefined, tooltip=Undefined, **kwds)¶ LineConfig schema wrapper
Mapping(required=[])Attributes: - align : HorizontalAlign
The horizontal alignment of the text. One of
"left"
,"right"
,"center"
.- angle : float
The rotation angle of the text, in degrees.
- baseline : VerticalAlign
The vertical alignment of the text. One of
"top"
,"middle"
,"bottom"
.Default value:
"middle"
- color : string
Default color. Note that
fill
andstroke
have higher precedence thancolor
and will overridecolor
.Default value: ■
"#4682b4"
Note: This property cannot be used in a style config.
- cornerRadius : float
The radius in pixels of rounded rectangle corners. Default value:
0
- cursor : Cursor
The mouse cursor used over the mark. Any valid CSS cursor type can be used.
- dir : Dir
The direction of the text. One of
"ltr"
(left-to-right) or"rtl"
(right-to-left). This property determines on which side is truncated in response to the limit parameter. Default value:"ltr"
- dx : float
The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- dy : float
The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- ellipsis : string
The ellipsis string for text truncated in response to the limit parameter. Default value:
"…"
- fill : string
Default Fill Color. This has higher precedence than
config.color
Default value: (None)
- fillOpacity : float
The fill opacity (value between [0,1]).
Default value:
1
- filled : boolean
Whether the mark’s color should be used as fill color instead of stroke color.
Default value:
true
for all marks exceptpoint
andfalse
forpoint
.Applicable for:
bar
,point
,circle
,square
, andarea
marks.Note: This property cannot be used in a style config.
- font : string
The typeface to set the text in (e.g.,
"Helvetica Neue"
).- fontSize : float
The font size, in pixels.
- fontStyle : FontStyle
The font style (e.g.,
"italic"
).- fontWeight : FontWeight
The font weight. This can be either a string (e.g
"bold"
,"normal"
) or a number (100
,200
,300
, …,900
where"normal"
=400
and"bold"
=700
).- href : string
A URL to load upon mouse click. If defined, the mark acts as a hyperlink.
- interpolate : Interpolate
The line interpolation method to use for line and area marks. One of the following:
"linear"
: piecewise linear segments, as in a polyline."linear-closed"
: close the linear segments to form a polygon."step"
: alternate between horizontal and vertical segments, as in a step function."step-before"
: alternate between vertical and horizontal segments, as in a step function."step-after"
: alternate between horizontal and vertical segments, as in a step function."basis"
: a B-spline, with control point duplication on the ends."basis-open"
: an open B-spline; may not intersect the start or end."basis-closed"
: a closed B-spline, as in a loop."cardinal"
: a Cardinal spline, with control point duplication on the ends."cardinal-open"
: an open Cardinal spline; may not intersect the start or end, but will intersect other control points."cardinal-closed"
: a closed Cardinal spline, as in a loop."bundle"
: equivalent to basis, except the tension parameter is used to straighten the spline."monotone"
: cubic interpolation that preserves monotonicity in y.
- limit : float
The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. Default value:
0
, indicating no limit- opacity : float
The overall opacity (value between [0,1]).
Default value:
0.7
for non-aggregate plots withpoint
,tick
,circle
, orsquare
marks or layeredbar
charts and1
otherwise.
orient : Orient
- <<<<<<< HEAD
The orientation of a non-stacked bar, tick, area, and line charts. The value is either horizontal (default) or vertical.
- For bar, rule and tick, this determines whether the size of the bar and tick
should be applied to x or y dimension. * For area, this property determines the orient property of the Vega output. * For line and trail marks, this property determines the sort order of the points in
the line
if
config.sortLineBy
is not specified. For stacked charts, this is always determined by the orientation of the stack; therefore explicitly specified value will be ignored.point : anyOf(boolean, MarkConfig, enum(‘transparent’))
- =======
The orientation of a non-stacked bar, tick, area, and line charts. The value is either horizontal (default) or vertical. * For bar, rule and tick, this determines
whether the size of the bar and tick should be applied to x or y dimension. * For area, this property determines the orient property of the Vega output. * For line
- and trail marks, this property determines the sort order of the points in the line
if
config.sortLineBy
is not specified. For stacked charts, this is always
determined by the orientation of the stack; therefore explicitly specified value will be ignored.
point : anyOf(boolean, OverlayMarkDef, enum(‘transparent’))
- >>>>>>> altair-viz/master
A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points.
If this property is
"transparent"
, transparent points will be used (for enhancing tooltips and selections).If this property is an empty object (
{}
) ortrue
, filled points with default properties will be used.If this property is
false
, no points would be automatically added to line or area marks.Default value:
false
.- radius : float
Polar coordinate radial offset, in pixels, of the text label from the origin determined by the
x
andy
properties.- shape : string
The default symbol shape to use. One of:
"circle"
(default),"square"
,"cross"
,"diamond"
,"triangle-up"
, or"triangle-down"
, or a custom SVG path.Default value:
"circle"
- size : float
The pixel area each the point/circle/square. For example: in the case of circles, the radius is determined in part by the square root of the size value.
Default value:
30
stroke : string
- <<<<<<< HEAD
Default Stroke Color. This has higher precedence than
config.color
Default value: (None)
strokeCap : enum(‘butt’, ‘round’, ‘square’)
- =======
Default Stroke Color. This has higher precedence than
config.color
Default value: (None)strokeCap : StrokeCap
- >>>>>>> altair-viz/master
The stroke cap for line ending style. One of
"butt"
,"round"
, or"square"
.Default value:
"square"
- strokeDash : List(float)
An array of alternating stroke, space lengths for creating dashed or dotted lines.
- strokeDashOffset : float
The offset (in pixels) into which to begin drawing with the stroke dash array.
- strokeJoin : StrokeJoin
The stroke line join method. One of
"miter"
,"round"
or"bevel"
. Default value:"miter"
- strokeMiterLimit : float
The miter limit at which to bevel a line join.
- strokeOpacity : float
The stroke opacity (value between [0,1]).
Default value:
1
- strokeWidth : float
The stroke width, in pixels.
- tension : float
Depending on the interpolation type, sets the tension parameter (for line and area marks).
- text : string
Placeholder text if the
text
channel is not specified- theta : float
Polar coordinate angle, in radians, of the text label from the origin determined by the
x
andy
properties. Values fortheta
follow the same convention ofarc
markstartAngle
andendAngle
properties: angles are measured in radians, with0
indicating “north”.- tooltip : Mapping(required=[])
The tooltip text to show upon mouse hover.
-
class
altair.
LocalMultiTimeUnit
(*args)¶ LocalMultiTimeUnit schema wrapper
enum(‘yearquarter’, ‘yearquartermonth’, ‘yearmonth’, ‘yearmonthdate’, ‘yearmonthdatehours’, ‘yearmonthdatehoursminutes’, ‘yearmonthdatehoursminutesseconds’, ‘quartermonth’, ‘monthdate’, ‘hoursminutes’, ‘hoursminutesseconds’, ‘minutesseconds’, ‘secondsmilliseconds’)
-
class
altair.
LocalSingleTimeUnit
(*args)¶ LocalSingleTimeUnit schema wrapper
enum(‘year’, ‘quarter’, ‘month’, ‘day’, ‘date’, ‘hours’, ‘minutes’, ‘seconds’, ‘milliseconds’)
-
class
altair.
LogicalAndPredicate
(**kwds)¶ LogicalAndPredicate schema wrapper
Mapping(required=[and])
Attributes: - and : List(LogicalOperandPredicate)
-
class
altair.
LogicalNotPredicate
(**kwds)¶ LogicalNotPredicate schema wrapper
Mapping(required=[not])
Attributes: - not : LogicalOperandPredicate
-
class
altair.
LogicalOperandPredicate
(*args, **kwds)¶ LogicalOperandPredicate schema wrapper
anyOf(LogicalNotPredicate, LogicalAndPredicate, LogicalOrPredicate, Predicate)
-
class
altair.
LogicalOrPredicate
(**kwds)¶ LogicalOrPredicate schema wrapper
Mapping(required=[or])
Attributes: - or : List(LogicalOperandPredicate)
-
class
altair.
Longitude
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Longitude schema wrapper
Mapping(required=[shorthand]) Definition object for a data field, its type and transformation of an encoding channel.
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
Longitude2
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Longitude2 schema wrapper
Mapping(required=[shorthand]) Definition object for a data field, its type and transformation of an encoding channel.
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
LookupData
(data=Undefined, key=Undefined, fields=Undefined, **kwds)¶ LookupData schema wrapper
Mapping(required=[data, key])
Attributes: - data : Data
Secondary data source to lookup in.
- key : string
Key in data to lookup.
- fields : List(string)
Fields in foreign data to lookup. If not specified, the entire object is queried.
-
to_dict
(*args, **kwargs)¶ Convert the chart to a dictionary suitable for JSON export
-
class
altair.
LookupTransform
(lookup=Undefined, default=Undefined, **kwds)¶ LookupTransform schema wrapper
Mapping(required=[lookup, from])
Attributes: - lookup : string
Key in primary data source.
- default : string
The default value to use if lookup fails.
Default value:
null
- as : anyOf(string, List(string))
The field or fields for storing the computed formula value. If
from.fields
is specified, the transform will use the same names foras
. Iffrom.fields
is not specified,as
has to be a string and we put the whole object into the data under the specified name.- from : LookupData
Secondary data reference.
-
class
altair.
Mark
(*args)¶ Mark schema wrapper
enum(‘area’, ‘bar’, ‘line’, ‘trail’, ‘point’, ‘text’, ‘tick’, ‘rect’, ‘rule’, ‘circle’, ‘square’, ‘geoshape’) All types of primitive marks.
-
class
altair.
MarkConfig
(align=Undefined, angle=Undefined, baseline=Undefined, color=Undefined, cornerRadius=Undefined, cursor=Undefined, dir=Undefined, dx=Undefined, dy=Undefined, ellipsis=Undefined, fill=Undefined, fillOpacity=Undefined, filled=Undefined, font=Undefined, fontSize=Undefined, fontStyle=Undefined, fontWeight=Undefined, href=Undefined, interpolate=Undefined, limit=Undefined, opacity=Undefined, orient=Undefined, radius=Undefined, shape=Undefined, size=Undefined, stroke=Undefined, strokeCap=Undefined, strokeDash=Undefined, strokeDashOffset=Undefined, strokeJoin=Undefined, strokeMiterLimit=Undefined, strokeOpacity=Undefined, strokeWidth=Undefined, tension=Undefined, text=Undefined, theta=Undefined, tooltip=Undefined, **kwds)¶ MarkConfig schema wrapper
Mapping(required=[])Attributes: - align : HorizontalAlign
The horizontal alignment of the text. One of
"left"
,"right"
,"center"
.- angle : float
The rotation angle of the text, in degrees.
- baseline : VerticalAlign
The vertical alignment of the text. One of
"top"
,"middle"
,"bottom"
.Default value:
"middle"
- color : string
Default color. Note that
fill
andstroke
have higher precedence thancolor
and will overridecolor
.Default value: ■
"#4682b4"
Note: This property cannot be used in a style config.
- cornerRadius : float
The radius in pixels of rounded rectangle corners. Default value:
0
- cursor : Cursor
The mouse cursor used over the mark. Any valid CSS cursor type can be used.
- dir : Dir
The direction of the text. One of
"ltr"
(left-to-right) or"rtl"
(right-to-left). This property determines on which side is truncated in response to the limit parameter. Default value:"ltr"
- dx : float
The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- dy : float
The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- ellipsis : string
The ellipsis string for text truncated in response to the limit parameter. Default value:
"…"
- fill : string
Default Fill Color. This has higher precedence than
config.color
Default value: (None)
- fillOpacity : float
The fill opacity (value between [0,1]).
Default value:
1
- filled : boolean
Whether the mark’s color should be used as fill color instead of stroke color.
Default value:
true
for all marks exceptpoint
andfalse
forpoint
.Applicable for:
bar
,point
,circle
,square
, andarea
marks.Note: This property cannot be used in a style config.
- font : string
The typeface to set the text in (e.g.,
"Helvetica Neue"
).- fontSize : float
The font size, in pixels.
- fontStyle : FontStyle
The font style (e.g.,
"italic"
).- fontWeight : FontWeight
The font weight. This can be either a string (e.g
"bold"
,"normal"
) or a number (100
,200
,300
, …,900
where"normal"
=400
and"bold"
=700
).- href : string
A URL to load upon mouse click. If defined, the mark acts as a hyperlink.
- interpolate : Interpolate
The line interpolation method to use for line and area marks. One of the following:
"linear"
: piecewise linear segments, as in a polyline."linear-closed"
: close the linear segments to form a polygon."step"
: alternate between horizontal and vertical segments, as in a step function."step-before"
: alternate between vertical and horizontal segments, as in a step function."step-after"
: alternate between horizontal and vertical segments, as in a step function."basis"
: a B-spline, with control point duplication on the ends."basis-open"
: an open B-spline; may not intersect the start or end."basis-closed"
: a closed B-spline, as in a loop."cardinal"
: a Cardinal spline, with control point duplication on the ends."cardinal-open"
: an open Cardinal spline; may not intersect the start or end, but will intersect other control points."cardinal-closed"
: a closed Cardinal spline, as in a loop."bundle"
: equivalent to basis, except the tension parameter is used to straighten the spline."monotone"
: cubic interpolation that preserves monotonicity in y.
- limit : float
The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. Default value:
0
, indicating no limit- opacity : float
The overall opacity (value between [0,1]).
Default value:
0.7
for non-aggregate plots withpoint
,tick
,circle
, orsquare
marks or layeredbar
charts and1
otherwise.- orient : Orient
The orientation of a non-stacked bar, tick, area, and line charts. The value is either horizontal (default) or vertical.
- For bar, rule and tick, this determines whether the size of the bar and tick
should be applied to x or y dimension. * For area, this property determines the orient property of the Vega output. * For line and trail marks, this property determines the sort order of the points in
the line
if
config.sortLineBy
is not specified. For stacked charts, this is always determined by the orientation of the stack; therefore explicitly specified value will be ignored.- radius : float
Polar coordinate radial offset, in pixels, of the text label from the origin determined by the
x
andy
properties.- shape : string
The default symbol shape to use. One of:
"circle"
(default),"square"
,"cross"
,"diamond"
,"triangle-up"
, or"triangle-down"
, or a custom SVG path.Default value:
"circle"
- size : float
The pixel area each the point/circle/square. For example: in the case of circles, the radius is determined in part by the square root of the size value.
Default value:
30
stroke : string
- <<<<<<< HEAD
Default Stroke Color. This has higher precedence than
config.color
Default value: (None)
strokeCap : enum(‘butt’, ‘round’, ‘square’)
- =======
Default Stroke Color. This has higher precedence than
config.color
Default value: (None)strokeCap : StrokeCap
- >>>>>>> altair-viz/master
The stroke cap for line ending style. One of
"butt"
,"round"
, or"square"
.Default value:
"square"
- strokeDash : List(float)
An array of alternating stroke, space lengths for creating dashed or dotted lines.
- strokeDashOffset : float
The offset (in pixels) into which to begin drawing with the stroke dash array.
- strokeJoin : StrokeJoin
The stroke line join method. One of
"miter"
,"round"
or"bevel"
. Default value:"miter"
- strokeMiterLimit : float
The miter limit at which to bevel a line join.
- strokeOpacity : float
The stroke opacity (value between [0,1]).
Default value:
1
- strokeWidth : float
The stroke width, in pixels.
- tension : float
Depending on the interpolation type, sets the tension parameter (for line and area marks).
- text : string
Placeholder text if the
text
channel is not specified- theta : float
Polar coordinate angle, in radians, of the text label from the origin determined by the
x
andy
properties. Values fortheta
follow the same convention ofarc
markstartAngle
andendAngle
properties: angles are measured in radians, with0
indicating “north”.- tooltip : Mapping(required=[])
The tooltip text to show upon mouse hover.
-
class
altair.
MarkDef
(type=Undefined, align=Undefined, angle=Undefined, baseline=Undefined, binSpacing=Undefined, clip=Undefined, color=Undefined, cornerRadius=Undefined, cursor=Undefined, dir=Undefined, dx=Undefined, dy=Undefined, ellipsis=Undefined, fill=Undefined, fillOpacity=Undefined, filled=Undefined, font=Undefined, fontSize=Undefined, fontStyle=Undefined, fontWeight=Undefined, href=Undefined, interpolate=Undefined, limit=Undefined, line=Undefined, opacity=Undefined, orient=Undefined, point=Undefined, radius=Undefined, shape=Undefined, size=Undefined, stroke=Undefined, strokeCap=Undefined, strokeDash=Undefined, strokeDashOffset=Undefined, strokeJoin=Undefined, strokeMiterLimit=Undefined, strokeOpacity=Undefined, strokeWidth=Undefined, style=Undefined, tension=Undefined, text=Undefined, theta=Undefined, thickness=Undefined, tooltip=Undefined, x2Offset=Undefined, xOffset=Undefined, y2Offset=Undefined, yOffset=Undefined, **kwds)¶ MarkDef schema wrapper
Mapping(required=[type])Attributes: - type : Mark
The mark type. One of
"bar"
,"circle"
,"square"
,"tick"
,"line"
,"area"
,"point"
,"geoshape"
,"rule"
, and"text"
.- align : HorizontalAlign
The horizontal alignment of the text. One of
"left"
,"right"
,"center"
.- angle : float
The rotation angle of the text, in degrees.
- baseline : VerticalAlign
The vertical alignment of the text. One of
"top"
,"middle"
,"bottom"
.Default value:
"middle"
- binSpacing : float
Offset between bars for binned field. Ideal value for this is either 0 (Preferred by statisticians) or 1 (Vega-Lite Default, D3 example style).
Default value:
1
- clip : boolean
Whether a mark be clipped to the enclosing group’s width and height.
- color : string
Default color. Note that
fill
andstroke
have higher precedence thancolor
and will overridecolor
.Default value: ■
"#4682b4"
Note: This property cannot be used in a style config.
- cornerRadius : float
The radius in pixels of rounded rectangle corners. Default value:
0
- cursor : Cursor
The mouse cursor used over the mark. Any valid CSS cursor type can be used.
- dir : Dir
The direction of the text. One of
"ltr"
(left-to-right) or"rtl"
(right-to-left). This property determines on which side is truncated in response to the limit parameter. Default value:"ltr"
- dx : float
The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- dy : float
The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- ellipsis : string
The ellipsis string for text truncated in response to the limit parameter. Default value:
"…"
- fill : string
Default Fill Color. This has higher precedence than
config.color
Default value: (None)
- fillOpacity : float
The fill opacity (value between [0,1]).
Default value:
1
- filled : boolean
Whether the mark’s color should be used as fill color instead of stroke color.
Default value:
true
for all marks exceptpoint
andfalse
forpoint
.Applicable for:
bar
,point
,circle
,square
, andarea
marks.Note: This property cannot be used in a style config.
- font : string
The typeface to set the text in (e.g.,
"Helvetica Neue"
).- fontSize : float
The font size, in pixels.
- fontStyle : FontStyle
The font style (e.g.,
"italic"
).- fontWeight : FontWeight
The font weight. This can be either a string (e.g
"bold"
,"normal"
) or a number (100
,200
,300
, …,900
where"normal"
=400
and"bold"
=700
).- href : string
A URL to load upon mouse click. If defined, the mark acts as a hyperlink.
- interpolate : Interpolate
The line interpolation method to use for line and area marks. One of the following:
"linear"
: piecewise linear segments, as in a polyline."linear-closed"
: close the linear segments to form a polygon."step"
: alternate between horizontal and vertical segments, as in a step function."step-before"
: alternate between vertical and horizontal segments, as in a step function."step-after"
: alternate between horizontal and vertical segments, as in a step function."basis"
: a B-spline, with control point duplication on the ends."basis-open"
: an open B-spline; may not intersect the start or end."basis-closed"
: a closed B-spline, as in a loop."cardinal"
: a Cardinal spline, with control point duplication on the ends."cardinal-open"
: an open Cardinal spline; may not intersect the start or end, but will intersect other control points."cardinal-closed"
: a closed Cardinal spline, as in a loop."bundle"
: equivalent to basis, except the tension parameter is used to straighten the spline."monotone"
: cubic interpolation that preserves monotonicity in y.
- limit : float
The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. Default value:
0
, indicating no limit- line : anyOf(boolean, OverlayMarkDef)
A flag for overlaying line on top of area marks, or an object defining the properties of the overlayed lines.
If this value is an empty object (
{}
) ortrue
, lines with default properties will be used.If this value is
false
, no lines would be automatically added to area marks.Default value:
false
.- opacity : float
The overall opacity (value between [0,1]).
Default value:
0.7
for non-aggregate plots withpoint
,tick
,circle
, orsquare
marks or layeredbar
charts and1
otherwise.
orient : Orient
- <<<<<<< HEAD
The orientation of a non-stacked bar, tick, area, and line charts. The value is either horizontal (default) or vertical.
- For bar, rule and tick, this determines whether the size of the bar and tick
should be applied to x or y dimension. * For area, this property determines the orient property of the Vega output. * For line and trail marks, this property determines the sort order of the points in
the line
if
config.sortLineBy
is not specified. For stacked charts, this is always determined by the orientation of the stack; therefore explicitly specified value will be ignored.point : anyOf(boolean, MarkConfig, enum(‘transparent’))
- =======
The orientation of a non-stacked bar, tick, area, and line charts. The value is either horizontal (default) or vertical. * For bar, rule and tick, this determines
whether the size of the bar and tick should be applied to x or y dimension. * For area, this property determines the orient property of the Vega output. * For line
- and trail marks, this property determines the sort order of the points in the line
if
config.sortLineBy
is not specified. For stacked charts, this is always
determined by the orientation of the stack; therefore explicitly specified value will be ignored.
point : anyOf(boolean, OverlayMarkDef, enum(‘transparent’))
- >>>>>>> altair-viz/master
A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points.
If this property is
"transparent"
, transparent points will be used (for enhancing tooltips and selections).If this property is an empty object (
{}
) ortrue
, filled points with default properties will be used.If this property is
false
, no points would be automatically added to line or area marks.Default value:
false
.- radius : float
Polar coordinate radial offset, in pixels, of the text label from the origin determined by the
x
andy
properties.- shape : string
The default symbol shape to use. One of:
"circle"
(default),"square"
,"cross"
,"diamond"
,"triangle-up"
, or"triangle-down"
, or a custom SVG path.Default value:
"circle"
- size : float
The pixel area each the point/circle/square. For example: in the case of circles, the radius is determined in part by the square root of the size value.
Default value:
30
stroke : string
- <<<<<<< HEAD
Default Stroke Color. This has higher precedence than
config.color
Default value: (None)
strokeCap : enum(‘butt’, ‘round’, ‘square’)
- =======
Default Stroke Color. This has higher precedence than
config.color
Default value: (None)strokeCap : StrokeCap
- >>>>>>> altair-viz/master
The stroke cap for line ending style. One of
"butt"
,"round"
, or"square"
.Default value:
"square"
- strokeDash : List(float)
An array of alternating stroke, space lengths for creating dashed or dotted lines.
- strokeDashOffset : float
The offset (in pixels) into which to begin drawing with the stroke dash array.
- strokeJoin : StrokeJoin
The stroke line join method. One of
"miter"
,"round"
or"bevel"
. Default value:"miter"
- strokeMiterLimit : float
The miter limit at which to bevel a line join.
- strokeOpacity : float
The stroke opacity (value between [0,1]).
Default value:
1
- strokeWidth : float
The stroke width, in pixels.
- style : anyOf(string, List(string))
A string or array of strings indicating the name of custom styles to apply to the mark. A style is a named collection of mark property defaults defined within the style configuration. If style is an array, later styles will override earlier styles. Any mark properties explicitly defined within the
encoding
will override a style default.Default value: The mark’s name. For example, a bar mark will have style
"bar"
by default. Note: Any specified style will augment the default style. For example, a bar mark with"style": "foo"
will receive fromconfig.style.bar
andconfig.style.foo
(the specified style"foo"
has higher precedence).- tension : float
Depending on the interpolation type, sets the tension parameter (for line and area marks).
- text : string
Placeholder text if the
text
channel is not specified- theta : float
Polar coordinate angle, in radians, of the text label from the origin determined by the
x
andy
properties. Values fortheta
follow the same convention ofarc
markstartAngle
andendAngle
properties: angles are measured in radians, with0
indicating “north”.
thickness : float
- <<<<<<< HEAD
Thickness of the tick mark.
Default value:
1
- =======
Thickness of the tick mark. Default value:
1
- tooltip : Mapping(required=[])
The tooltip text to show upon mouse hover.
- >>>>>>> altair-viz/master
- x2Offset : float
Offset for x2-position.
- xOffset : float
Offset for x-position.
- y2Offset : float
Offset for y2-position.
- yOffset : float
Offset for y-position.
-
class
altair.
MarkPropFieldDefWithCondition
(type=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, **kwds)¶ MarkPropFieldDefWithCondition schema wrapper
Mapping(required=[type]) A FieldDef with ConditionAttributes: - type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- legend : anyOf(Legend, None)
An object defining properties of the legend. If
null
, the legend for the encoding channel will be removed.Default value: If undefined, default legend properties are applied.
- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- <<<<<<< HEAD
- sort : anyOf(List(string), SortOrder, EncodingSortField, None)
Sort order for the encoded field. Supported
sort
values include"ascending"
,"descending"
,null
(no sorting), or an array specifying the preferred order of values. For fields with discrete domains,sort
can also be a sort field definition object. Forsort
as an array specifying the preferred order of values, the sort order will obey the values in the array, followed by any unspecified values in their original order.Default value:
"ascending"
- =======
- sort : 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"
– forsorting by the values’ natural order in Javascript. * `A sort field definition
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`_ for sorting by another field. * An array specifying the field values in preferred order. In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). *null
indicating no sort. Default value:"ascending"
Note:null
is not supported forrow
andcolumn
.
- >>>>>>> altair-viz/master
- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.
-
class
altair.
MarkPropValueDefWithCondition
(condition=Undefined, value=Undefined, **kwds)¶ MarkPropValueDefWithCondition schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalMarkPropFieldDef, ConditionalValueDef,
- List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
Month
(*args)¶ Month schema wrapper
float
-
class
altair.
MultiSelection
(type=Undefined, empty=Undefined, encodings=Undefined, fields=Undefined, nearest=Undefined, on=Undefined, resolve=Undefined, toggle=Undefined, **kwds)¶ MultiSelection schema wrapper
Mapping(required=[type])
Attributes: - type : enum(‘multi’)
- empty : enum(‘all’, ‘none’)
By default, all data values are considered to lie within an empty selection. When set to
none
, empty selections contain no data values.- encodings : List(SingleDefChannel)
An array of encoding channels. The corresponding data field values must match for a data tuple to fall within the selection.
- fields : List(string)
An array of field names whose values must match for a data tuple to fall within the selection.
- nearest : boolean
When true, an invisible voronoi diagram is computed to accelerate discrete selection. The data value nearest the mouse cursor is added to the selection.
See the nearest transform documentation for more information.
- on : VgEventStream
A Vega event stream (object or selector) that triggers the selection. For interval selections, the event stream must specify a start and end.
- resolve : SelectionResolution
With layered and multi-view displays, a strategy that determines how selections’ data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain.
- toggle : anyOf(string, boolean)
Controls whether data values should be toggled or only ever inserted into multi selections. Can be
true
,false
(for insertion only), or a Vega expression.Default value:
true
, which corresponds toevent.shiftKey
(i.e., data values are toggled when a user interacts with the shift-key pressed).See the toggle transform documentation for more information.
-
class
altair.
MultiSelectionConfig
(empty=Undefined, encodings=Undefined, fields=Undefined, nearest=Undefined, on=Undefined, resolve=Undefined, toggle=Undefined, **kwds)¶ MultiSelectionConfig schema wrapper
Mapping(required=[])
Attributes: - empty : enum(‘all’, ‘none’)
By default, all data values are considered to lie within an empty selection. When set to
none
, empty selections contain no data values.- encodings : List(SingleDefChannel)
An array of encoding channels. The corresponding data field values must match for a data tuple to fall within the selection.
- fields : List(string)
An array of field names whose values must match for a data tuple to fall within the selection.
- nearest : boolean
When true, an invisible voronoi diagram is computed to accelerate discrete selection. The data value nearest the mouse cursor is added to the selection.
See the nearest transform documentation for more information.
- on : VgEventStream
A Vega event stream (object or selector) that triggers the selection. For interval selections, the event stream must specify a start and end.
- resolve : SelectionResolution
With layered and multi-view displays, a strategy that determines how selections’ data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain.
- toggle : anyOf(string, boolean)
Controls whether data values should be toggled or only ever inserted into multi selections. Can be
true
,false
(for insertion only), or a Vega expression.Default value:
true
, which corresponds toevent.shiftKey
(i.e., data values are toggled when a user interacts with the shift-key pressed).See the toggle transform documentation for more information.
-
class
altair.
MultiTimeUnit
(*args, **kwds)¶ MultiTimeUnit schema wrapper
anyOf(LocalMultiTimeUnit, UtcMultiTimeUnit)
-
class
altair.
NamedData
(name=Undefined, format=Undefined, **kwds)¶ NamedData schema wrapper
Mapping(required=[name])
Attributes: - name : string
Provide a placeholder name and bind data at runtime.
- format : DataFormat
An object that specifies the format for parsing the data.
-
class
altair.
NamedSelection
(*args, **kwds)¶ A SelectionMapping with a single named selection item
-
ref
()¶ Return a selection reference to this object
Examples
>>> import altair as alt >>> sel = alt.selection_interval(name='interval') >>> sel.ref() {'selection': 'interval'}
-
-
class
altair.
NiceTime
(*args)¶ NiceTime schema wrapper
enum(‘second’, ‘minute’, ‘hour’, ‘day’, ‘week’, ‘month’, ‘year’)
-
class
altair.
Opacity
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds) Opacity schema wrapper
Mapping(required=[shorthand]) A FieldDef with Condition
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- legend : anyOf(Legend, None)
An object defining properties of the legend. If
null
, the legend for the encoding channel will be removed.Default value: If undefined, default legend properties are applied.
- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
OpacityValue
(value, condition=Undefined, **kwds) OpacityValue schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalMarkPropFieldDef, ConditionalValueDef,
- List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
Order
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds) Order schema wrapper
Mapping(required=[shorthand])
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- sort : SortOrder
The sort order. One of
"ascending"
(default) or"descending"
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
OrderFieldDef
(type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, **kwds)¶ OrderFieldDef schema wrapper
Mapping(required=[type])
Attributes: - type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- sort : SortOrder
The sort order. One of
"ascending"
(default) or"descending"
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.
-
class
altair.
OrderValue
(value, **kwds)¶ OrderValue schema wrapper
Mapping(required=[value]) Definition object for a constant value of an encoding channel.
Attributes: - value : anyOf(float, string, boolean)
A constant value in visual domain (e.g.,
"red"
/ “#0099ff” for color, values between0
to1
for opacity).
-
class
altair.
Orient
(*args)¶ Orient schema wrapper
enum(‘horizontal’, ‘vertical’)
-
class
altair.
OverlayMarkDef
(align=Undefined, angle=Undefined, baseline=Undefined, clip=Undefined, color=Undefined, cornerRadius=Undefined, cursor=Undefined, dir=Undefined, dx=Undefined, dy=Undefined, ellipsis=Undefined, fill=Undefined, fillOpacity=Undefined, filled=Undefined, font=Undefined, fontSize=Undefined, fontStyle=Undefined, fontWeight=Undefined, href=Undefined, interpolate=Undefined, limit=Undefined, opacity=Undefined, orient=Undefined, radius=Undefined, shape=Undefined, size=Undefined, stroke=Undefined, strokeCap=Undefined, strokeDash=Undefined, strokeDashOffset=Undefined, strokeJoin=Undefined, strokeMiterLimit=Undefined, strokeOpacity=Undefined, strokeWidth=Undefined, style=Undefined, tension=Undefined, text=Undefined, theta=Undefined, tooltip=Undefined, x2Offset=Undefined, xOffset=Undefined, y2Offset=Undefined, yOffset=Undefined, **kwds)¶ OverlayMarkDef schema wrapper
Mapping(required=[])
Attributes: - align : HorizontalAlign
The horizontal alignment of the text. One of
"left"
,"right"
,"center"
.- angle : float
The rotation angle of the text, in degrees.
- baseline : VerticalAlign
The vertical alignment of the text. One of
"top"
,"middle"
,"bottom"
. Default value:"middle"
- clip : boolean
Whether a mark be clipped to the enclosing group’s width and height.
- color : string
Default color. Note that
fill
andstroke
have higher precedence thancolor
and will overridecolor
. Default value: ■"#4682b4"
Note: This property cannot be used in a style config.- cornerRadius : float
The radius in pixels of rounded rectangle corners. Default value:
0
- cursor : Cursor
The mouse cursor used over the mark. Any valid CSS cursor type can be used.
- dir : Dir
The direction of the text. One of
"ltr"
(left-to-right) or"rtl"
(right-to-left). This property determines on which side is truncated in response to the limit parameter. Default value:"ltr"
- dx : float
The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- dy : float
The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- ellipsis : string
The ellipsis string for text truncated in response to the limit parameter. Default value:
"…"
- fill : string
Default Fill Color. This has higher precedence than
config.color
Default value: (None)- fillOpacity : float
The fill opacity (value between [0,1]). Default value:
1
- filled : boolean
Whether the mark’s color should be used as fill color instead of stroke color. Default value:
true
for all marks exceptpoint
andfalse
forpoint
. Applicable for:bar
,point
,circle
,square
, andarea
marks. Note: This property cannot be used in a style config.- font : string
The typeface to set the text in (e.g.,
"Helvetica Neue"
).- fontSize : float
The font size, in pixels.
- fontStyle : FontStyle
The font style (e.g.,
"italic"
).- fontWeight : FontWeight
The font weight. This can be either a string (e.g
"bold"
,"normal"
) or a number (100
,200
,300
, …,900
where"normal"
=400
and"bold"
=700
).- href : string
A URL to load upon mouse click. If defined, the mark acts as a hyperlink.
- interpolate : Interpolate
- The line interpolation method to use for line and area marks. One of the following:
"linear"
: piecewise linear segments, as in a polyline. *
"linear-closed"
: close the linear segments to form a polygon. *"step"
: alternate between horizontal and vertical segments, as in a step function. *"step-before"
: alternate between vertical and horizontal segments, as in a stepfunction. *
"step-after"
: alternate between horizontal and vertical segments,- as in a step function. *
"basis"
: a B-spline, with control point duplication on the ends. *
"basis-open"
: an open B-spline; may not intersect the start or
end. *
"basis-closed"
: a closed B-spline, as in a loop. *"cardinal"
: a Cardinal spline, with control point duplication on the ends. *"cardinal-open"
:an open Cardinal spline; may not intersect the start or end, but will intersect
other control points. *
"cardinal-closed"
: a closed Cardinal spline, as in a loop. *"bundle"
: equivalent to basis, except the tension parameter is used to straighten the spline. *"monotone"
: cubic interpolation that preserves monotonicity in y.- limit : float
The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. Default value:
0
, indicating no limit- opacity : float
The overall opacity (value between [0,1]). Default value:
0.7
for non-aggregate plots withpoint
,tick
,circle
, orsquare
marks or layeredbar
charts and1
otherwise.- orient : Orient
The orientation of a non-stacked bar, tick, area, and line charts. The value is either horizontal (default) or vertical. * For bar, rule and tick, this determines
whether the size of the bar and tick should be applied to x or y dimension. * For area, this property determines the orient property of the Vega output. * For line
- and trail marks, this property determines the sort order of the points in the line
if
config.sortLineBy
is not specified. For stacked charts, this is always
determined by the orientation of the stack; therefore explicitly specified value will be ignored.
- radius : float
Polar coordinate radial offset, in pixels, of the text label from the origin determined by the
x
andy
properties.- shape : string
The default symbol shape to use. One of:
"circle"
(default),"square"
,"cross"
,"diamond"
,"triangle-up"
, or"triangle-down"
, or a custom SVG path. Default value:"circle"
- size : float
The pixel area each the point/circle/square. For example: in the case of circles, the radius is determined in part by the square root of the size value. Default value:
30
- stroke : string
Default Stroke Color. This has higher precedence than
config.color
Default value: (None)- strokeCap : StrokeCap
The stroke cap for line ending style. One of
"butt"
,"round"
, or"square"
. Default value:"square"
- strokeDash : List(float)
An array of alternating stroke, space lengths for creating dashed or dotted lines.
- strokeDashOffset : float
The offset (in pixels) into which to begin drawing with the stroke dash array.
- strokeJoin : StrokeJoin
The stroke line join method. One of
"miter"
,"round"
or"bevel"
. Default value:"miter"
- strokeMiterLimit : float
The miter limit at which to bevel a line join.
- strokeOpacity : float
The stroke opacity (value between [0,1]). Default value:
1
- strokeWidth : float
The stroke width, in pixels.
- style : anyOf(string, List(string))
A string or array of strings indicating the name of custom styles to apply to the mark. A style is a named collection of mark property defaults defined within the style configuration. If style is an array, later styles will override earlier styles. Any mark properties explicitly defined
within the
encoding
will override a style default. Default value: Themark’s name. For example, a bar mark will have style
"bar"
by default. Note: Any specified style will augment the default style. For example, a bar mark with"style": "foo"
will receive fromconfig.style.bar
andconfig.style.foo
(the specified style"foo"
has higher precedence).- tension : float
Depending on the interpolation type, sets the tension parameter (for line and area marks).
- text : string
Placeholder text if the
text
channel is not specified- theta : float
Polar coordinate angle, in radians, of the text label from the origin determined by the
x
andy
properties. Values fortheta
follow the same convention ofarc
markstartAngle
andendAngle
properties: angles are measured in radians, with0
indicating “north”.- tooltip : Mapping(required=[])
The tooltip text to show upon mouse hover.
- x2Offset : float
Offset for x2-position.
- xOffset : float
Offset for x-position.
- y2Offset : float
Offset for y2-position.
- yOffset : float
Offset for y-position.
-
class
altair.
Padding
(*args, **kwds)¶ Padding schema wrapper
anyOf(float, Mapping(required=[]))
-
class
altair.
Parse
(**kwds)¶ Parse schema wrapper
Mapping(required=[])
-
class
altair.
PositionFieldDef
(type=Undefined, aggregate=Undefined, axis=Undefined, bin=Undefined, field=Undefined, scale=Undefined, sort=Undefined, stack=Undefined, timeUnit=Undefined, title=Undefined, **kwds)¶ PositionFieldDef schema wrapper
Mapping(required=[type])Attributes: - type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- axis : anyOf(Axis, None)
An object defining properties of axis’s gridlines, ticks and labels. If
null
, the axis for the encoding channel will be removed.Default value: If undefined, default axis properties are applied.
- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- <<<<<<< HEAD
- sort : anyOf(List(string), SortOrder, EncodingSortField, None)
Sort order for the encoded field. Supported
sort
values include"ascending"
,"descending"
,null
(no sorting), or an array specifying the preferred order of values. For fields with discrete domains,sort
can also be a sort field definition object. Forsort
as an array specifying the preferred order of values, the sort order will obey the values in the array, followed by any unspecified values in their original order.Default value:
"ascending"
- =======
- sort : 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"
– forsorting by the values’ natural order in Javascript. * `A sort field definition
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`_ for sorting by another field. * An array specifying the field values in preferred order. In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). *null
indicating no sort. Default value:"ascending"
Note:null
is not supported forrow
andcolumn
.
- >>>>>>> altair-viz/master
- stack : anyOf(StackOffset, None)
Type of stacking offset if the field should be stacked.
stack
is only applicable forx
andy
channels with continuous domains. For example,stack
ofy
can be used to customize stacking for a vertical bar chart.stack
can be one of the following values:- “zero”: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and area chart).
"normalize"
- stacking with normalized domain (for creating normalized stacked bar and area charts.
"center"
- stacking with center baseline (for `streamgraph
<https://vega.github.io/vega-lite/docs/stack.html#streamgraph>`_ ). *
null
- No-stacking. This will produce layered `bar<https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart>`_ and area chart.
Default value:
zero
for plots with all of the following conditions are true: (1) the mark isbar
orarea
; (2) the stacked measure channel (x or y) has a linear scale; (3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise,null
by default.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.
-
class
altair.
Predicate
(*args, **kwds)¶ Predicate schema wrapper
anyOf(FieldEqualPredicate, FieldRangePredicate, FieldOneOfPredicate, FieldLTPredicate, FieldGTPredicate, FieldLTEPredicate, FieldGTEPredicate, SelectionPredicate, string)
-
class
altair.
Projection
(center=Undefined, clipAngle=Undefined, clipExtent=Undefined, coefficient=Undefined, distance=Undefined, fraction=Undefined, lobes=Undefined, parallel=Undefined, precision=Undefined, radius=Undefined, ratio=Undefined, rotate=Undefined, spacing=Undefined, tilt=Undefined, type=Undefined, **kwds)¶ Projection schema wrapper
Mapping(required=[])
Attributes: - center : List(float)
Sets the projection’s center to the specified center, a two-element array of longitude and latitude in degrees.
Default value:
[0, 0]
- clipAngle : float
Sets the projection’s clipping circle radius to the specified angle in degrees. If
null
, switches to antimeridian cutting rather than small-circle clipping.- clipExtent : List(List(float))
Sets the projection’s viewport clip extent to the specified bounds in pixels. The extent bounds are specified as an array
[[x0, y0], [x1, y1]]
, wherex0
is the left-side of the viewport,y0
is the top,x1
is the right andy1
is the bottom. Ifnull
, no viewport clipping is performed.- coefficient : float
- distance : float
- fraction : float
- lobes : float
- parallel : float
- precision : Mapping(required=[length])
Sets the threshold for the projection’s adaptive resampling to the specified value in pixels. This value corresponds to the Douglas–Peucker distance. If precision is not specified, returns the projection’s current resampling precision which defaults to
√0.5 ≅ 0.70710…
.- radius : float
- ratio : float
- rotate : List(float)
Sets the projection’s three-axis rotation to the specified angles, which must be a two- or three-element array of numbers [
lambda
,phi
,gamma
] specifying the rotation angles in degrees about each spherical axis. (These correspond to yaw, pitch and roll.)Default value:
[0, 0, 0]
- spacing : float
- tilt : float
- type : ProjectionType
The cartographic projection to use. This value is case-insensitive, for example
"albers"
and"Albers"
indicate the same projection type. You can find all valid projection types in the documentation.Default value:
mercator
-
class
altair.
ProjectionConfig
(center=Undefined, clipAngle=Undefined, clipExtent=Undefined, coefficient=Undefined, distance=Undefined, fraction=Undefined, lobes=Undefined, parallel=Undefined, precision=Undefined, radius=Undefined, ratio=Undefined, rotate=Undefined, spacing=Undefined, tilt=Undefined, type=Undefined, **kwds)¶ ProjectionConfig schema wrapper
Mapping(required=[]) Any property of Projection can be in config
Attributes: - center : List(float)
Sets the projection’s center to the specified center, a two-element array of longitude and latitude in degrees.
Default value:
[0, 0]
- clipAngle : float
Sets the projection’s clipping circle radius to the specified angle in degrees. If
null
, switches to antimeridian cutting rather than small-circle clipping.- clipExtent : List(List(float))
Sets the projection’s viewport clip extent to the specified bounds in pixels. The extent bounds are specified as an array
[[x0, y0], [x1, y1]]
, wherex0
is the left-side of the viewport,y0
is the top,x1
is the right andy1
is the bottom. Ifnull
, no viewport clipping is performed.- coefficient : float
- distance : float
- fraction : float
- lobes : float
- parallel : float
- precision : Mapping(required=[length])
Sets the threshold for the projection’s adaptive resampling to the specified value in pixels. This value corresponds to the Douglas–Peucker distance. If precision is not specified, returns the projection’s current resampling precision which defaults to
√0.5 ≅ 0.70710…
.- radius : float
- ratio : float
- rotate : List(float)
Sets the projection’s three-axis rotation to the specified angles, which must be a two- or three-element array of numbers [
lambda
,phi
,gamma
] specifying the rotation angles in degrees about each spherical axis. (These correspond to yaw, pitch and roll.)Default value:
[0, 0, 0]
- spacing : float
- tilt : float
- type : ProjectionType
The cartographic projection to use. This value is case-insensitive, for example
"albers"
and"Albers"
indicate the same projection type. You can find all valid projection types in the documentation.Default value:
mercator
-
class
altair.
ProjectionType
(*args)¶ ProjectionType schema wrapper
enum(‘albers’, ‘albersUsa’, ‘azimuthalEqualArea’, ‘azimuthalEquidistant’, ‘conicConformal’, ‘conicEqualArea’, ‘conicEquidistant’, ‘equirectangular’, ‘gnomonic’, ‘mercator’, ‘orthographic’, ‘stereographic’, ‘transverseMercator’)
-
class
altair.
RangeConfig
(category=Undefined, diverging=Undefined, heatmap=Undefined, ordinal=Undefined, ramp=Undefined, symbol=Undefined, **kwds)¶ RangeConfig schema wrapper
Mapping(required=[])
Attributes: - category : anyOf(List(string), VgScheme)
Default range for nominal (categorical) fields.
- diverging : anyOf(List(string), VgScheme)
Default range for diverging quantitative fields.
- heatmap : anyOf(List(string), VgScheme)
Default range for quantitative heatmaps.
- ordinal : anyOf(List(string), VgScheme)
Default range for ordinal fields.
- ramp : anyOf(List(string), VgScheme)
Default range for quantitative and temporal fields.
- symbol : List(string)
Default range palette for the
shape
channel.
-
class
altair.
RangeConfigValue
(*args, **kwds)¶ RangeConfigValue schema wrapper
anyOf(List(anyOf(float, string)), VgScheme, Mapping(required=[step]))
-
class
altair.
Repeat
(column=Undefined, row=Undefined, **kwds)¶ Repeat schema wrapper
Mapping(required=[])
Attributes: - column : List(string)
Horizontal repeated views.
- row : List(string)
Vertical repeated views.
-
class
altair.
RepeatChart
(data=Undefined, spec=Undefined, repeat=Undefined, **kwargs) - A chart repeated across rows and columns with small changes
- Mapping(required=[repeat, spec])
Attributes: repeat
: RepeatReturn a RepeatChart built from the chart
- <<<<<<< HEAD
CSS color property to use as the background of visualization.
Default value: none (transparent)
- =======
CSS color property to use as the background of visualization. Default value: none (transparent)
- bounds : enum(‘full’, ‘flush’)
The bounds calculation method to use for determining the extent of a sub-plot. One of
full
(the default) orflush
. * If set tofull
, the entire calculated bounds (including axes, title, and legend) will be used. * If set toflush
, only the specified width and height values for the sub-view will be used.The
flush
setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. Default value:"full"
- center : anyOf(boolean, RowColboolean)
Boolean flag indicating if subviews should be centered relative to their respective rows or columns. An object value of the form
{"row": boolean, "column": boolean}
can be used to supply different centering values for rows and columns. Default value:false
- >>>>>>> altair-viz/master
- config : Config
Vega-Lite configuration object. This property can only be defined at the top-level of a specification.
- data : Data
An object describing the data source
- datasets : Datasets
A global data store for named datasets. This is a mapping from names to inline datasets. This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a
data
property.- description : string
Description of this mark for commenting purpose.
- name : string
Name of the visualization for later reference.
- padding : Padding
The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format
{"left": 5, "top": 5, "right": 5, "bottom": 5}
to specify padding for each side of the visualization.Default value :
5
- resolve : Resolve
Scale and legend resolutions for repeated charts.
- spacing : anyOf(float, RowColnumber)
The spacing in pixels between sub-views of the composition operator. An object of the form
{"row": number, "column": number}
can be used to set different spacing values for rows and columns. Default value :10
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- $schema : string
URL to JSON schema for a Vega-Lite specification. Unless you have a reason to change this, use
https://vega.github.io/schema/vega-lite/v2.json
. Setting the$schema
property allows automatic validation and autocomplete in editors that support JSON schema.
-
interactive
(name=None, bind_x=True, bind_y=True) Make chart axes scales interactive
Parameters: - name : string
The selection name to use for the axes scales. This name should be unique among all selections within the chart.
- bind_x : boolean, default True
If true, then bind the interactive scales to the x-axis
- bind_y : boolean, default True
If true, then bind the interactive scales to the y-axis
Returns: - chart :
copy of self, with interactive axes added
-
class
altair.
RepeatRef
(repeat=Undefined, **kwds)¶ RepeatRef schema wrapper
Mapping(required=[repeat]) Reference to a repeated value.
Attributes: - repeat : enum(‘row’, ‘column’)
-
class
altair.
RepeatSpec
(repeat=Undefined, spec=Undefined, align=Undefined, bounds=Undefined, center=Undefined, data=Undefined, description=Undefined, name=Undefined, resolve=Undefined, spacing=Undefined, title=Undefined, transform=Undefined, **kwds)¶ RepeatSpec schema wrapper
Mapping(required=[repeat, spec])
Attributes: - repeat : Repeat
An object that describes what fields should be repeated into views that are laid out as a
row
orcolumn
.- spec : Spec
- align : anyOf(VgLayoutAlign, RowColVgLayoutAlign)
The alignment to apply to grid rows and columns. 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. Alternatively, an object value of the form{"row": string, "column": string}
canbe used to supply different alignments for rows and columns. Default value:
"all"
.- bounds : enum(‘full’, ‘flush’)
The bounds calculation method to use for determining the extent of a sub-plot. One of
full
(the default) orflush
. * If set tofull
, the entire calculated bounds (including axes, title, and legend) will be used. * If set toflush
, only the specified width and height values for the sub-view will be used.The
flush
setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. Default value:"full"
- center : anyOf(boolean, RowColboolean)
Boolean flag indicating if subviews should be centered relative to their respective rows or columns. An object value of the form
{"row": boolean, "column": boolean}
can be used to supply different centering values for rows and columns. Default value:false
- data : Data
An object describing the data source
- description : string
Description of this mark for commenting purpose.
- name : string
Name of the visualization for later reference.
- resolve : Resolve
Scale and legend resolutions for repeated charts.
- spacing : anyOf(float, RowColnumber)
The spacing in pixels between sub-views of the composition operator. An object of the form
{"row": number, "column": number}
can be used to set different spacing values for rows and columns. Default value :10
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
-
class
altair.
Resolve
(axis=Undefined, legend=Undefined, scale=Undefined, **kwds)¶ Resolve schema wrapper
Mapping(required=[]) Defines how scales, axes, and legends from different specs should be combined. Resolve is a mapping from
scale
,axis
, andlegend
to a mapping from channels to resolutions.Attributes: - axis : AxisResolveMap
- legend : LegendResolveMap
- scale : ScaleResolveMap
-
class
altair.
ResolveMode
(*args)¶ ResolveMode schema wrapper
enum(‘independent’, ‘shared’)
-
class
altair.
Root
(*args, **kwds)¶ Root schema wrapper
anyOf(TopLevelFacetedUnitSpec, TopLevelFacetSpec, TopLevelLayerSpec, TopLevelRepeatSpec, TopLevelVConcatSpec, TopLevelHConcatSpec)
-
class
altair.
Row
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, header=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds) Row schema wrapper
Mapping(required=[shorthand])
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- header : Header
An object defining properties of a facet’s header.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
RowColVgLayoutAlign
(column=Undefined, row=Undefined, **kwds)¶ RowColVgLayoutAlign schema wrapper
Mapping(required=[])
Attributes: - column : VgLayoutAlign
- row : VgLayoutAlign
-
class
altair.
RowColboolean
(column=Undefined, row=Undefined, **kwds)¶ RowColboolean schema wrapper
Mapping(required=[])
Attributes: - column : boolean
- row : boolean
-
class
altair.
RowColnumber
(column=Undefined, row=Undefined, **kwds)¶ RowColnumber schema wrapper
Mapping(required=[])
Attributes: - column : float
- row : float
-
class
altair.
Scale
(base=Undefined, clamp=Undefined, domain=Undefined, exponent=Undefined, interpolate=Undefined, nice=Undefined, padding=Undefined, paddingInner=Undefined, paddingOuter=Undefined, range=Undefined, rangeStep=Undefined, round=Undefined, scheme=Undefined, type=Undefined, zero=Undefined, **kwds)¶ Scale schema wrapper
Mapping(required=[])
Attributes: - base : float
The logarithm base of the
log
scale (default10
).- clamp : boolean
If
true
, values that exceed the data domain are clamped to either the minimum or maximum range valueDefault value: derived from the scale config ‘s
clamp
(true
by default).- domain : anyOf(List(float), List(string), List(boolean), List(DateTime),
- enum(‘unaggregated’), SelectionDomain)
Customized domain values.
For quantitative fields,
domain
can take the form of a two-element array with minimum and maximum values. Piecewise scales can be created by providing adomain
with more than two entries. If the input field is aggregated,domain
can also be a string value"unaggregated"
, indicating that the domain should include the raw data values prior to the aggregation.For temporal fields,
domain
can be a two-element array minimum and maximum values, in the form of either timestamps or the DateTime definition objects.For ordinal and nominal fields,
domain
can be an array that lists valid input values.The
selection
property can be used to interactively determine the scale domain.- exponent : float
The exponent of the
pow
scale.- interpolate : anyOf(ScaleInterpolate, ScaleInterpolateParams)
The interpolation method for range values. By default, a general interpolator for numbers, dates, strings and colors (in RGB space) is used. For color ranges, this property allows interpolation in alternative color spaces. Legal values include
rgb
,hsl
,hsl-long
,lab
,hcl
,hcl-long
,cubehelix
andcubehelix-long
(‘-long’ variants use longer paths in polar coordinate spaces). If object-valued, this property accepts an object with a string-valued type property and an optional numeric gamma property applicable to rgb and cubehelix interpolators. For more, see the d3-interpolate documentation.Note: Sequential scales do not support
interpolate
as they have a fixed interpolator. Since Vega-Lite uses sequential scales for quantitative fields by default, you have to set the scaletype
to other quantitative scale type such as"linear"
to customizeinterpolate
.- nice : anyOf(boolean, float, NiceTime, Mapping(required=[interval, step]))
Extending the domain so that it starts and ends on nice round values. This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of [0.201479…, 0.996679…], a nice domain might be [0.2, 1.0].
For quantitative scales such as linear,
nice
can be either a boolean flag or a number. Ifnice
is a number, it will represent a desired tick count. This allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain.For temporal fields with time and utc scales, the
nice
value can be a string indicating the desired time interval. Legal values are"millisecond"
,"second"
,"minute"
,"hour"
,"day"
,"week"
,"month"
, and"year"
. Alternatively,time
andutc
scales can accept an object-valued interval specifier of the form{"interval": "month", "step": 3}
, which includes a desired number of interval steps. Here, the domain would snap to quarter (Jan, Apr, Jul, Oct) boundaries.Default value:
true
for unbinned quantitative fields;false
otherwise.- padding : float
For * continuous * scales, expands the scale domain to accommodate the specified number of pixels on each of the scale range. The scale range must represent pixels for this parameter to function as intended. Padding adjustment is performed prior to all other adjustments, including the effects of the zero, nice, domainMin, and domainMax properties.
For * band * scales, shortcut for setting
paddingInner
andpaddingOuter
to the same value.For * point * scales, alias for
paddingOuter
.Default value: For continuous scales, derived from the scale config ‘s
continuousPadding
. For band and point scales, seepaddingInner
andpaddingOuter
.- paddingInner : float
The inner padding (spacing) within each band step of band scales, as a fraction of the step size. This value must lie in the range [0,1].
For point scale, this property is invalid as point scales do not have internal band widths (only step sizes between bands).
Default value: derived from the scale config ‘s
bandPaddingInner
.- paddingOuter : float
The outer padding (spacing) at the ends of the range of band and point scales, as a fraction of the step size. This value must lie in the range [0,1].
Default value: derived from the scale config ‘s
bandPaddingOuter
for band scales andpointPadding
for point scales.- range : anyOf(List(float), List(string), string)
The range of the scale. One of:
A string indicating a pre-defined named scale range (e.g., example,
"symbol"
, or"diverging"
).For continuous scales, two-element array indicating minimum and maximum values, or an array with more than two entries for specifying a piecewise scale.
For discrete and discretizing scales, an array of desired output values.
Notes:
1) For sequential, ordinal, and discretizing color scales, you can also specify a color scheme instead of
range
.2) Any directly specified
range
forx
andy
channels will be ignored. Range can be customized via the view’s corresponding size (width
andheight
) or via range steps and paddings properties for band and point scales.- rangeStep : anyOf(float, None)
The distance between the starts of adjacent bands or points in band and point scales.
If
rangeStep
isnull
or if the view contains the scale’s corresponding size (width
forx
scales andheight
fory
scales),rangeStep
will be automatically determined to fit the size of the view.Default value: derived the scale config ‘s
textXRangeStep
(90
by default) for x-scales oftext
marks andrangeStep
(21
by default) for x-scales of other marks and y-scales.Warning : If
rangeStep
isnull
and the cardinality of the scale’s domain is higher thanwidth
orheight
, the rangeStep might become less than one pixel and the mark might not appear correctly.- round : boolean
If
true
, rounds numeric output values to integers. This can be helpful for snapping to the pixel grid.Default value:
false
.- scheme : anyOf(string, SchemeParams)
A string indicating a color scheme name (e.g.,
"category10"
or"viridis"
) or a scheme parameter object.Discrete color schemes may be used with discrete or discretizing scales. Continuous color schemes are intended for use with sequential scales.
For the full list of supported schemes, please refer to the Vega Scheme reference.
- type : ScaleType
The type of scale. Vega-Lite supports the following categories of scale types:
1) Continuous Scales – mapping continuous domains to continuous output ranges ( “linear”, “pow”, “sqrt”, “log”, “time”, “utc”, “sequential” ).
2) Discrete Scales – mapping discrete domains to discrete ( “ordinal” ) or continuous ( “band” and “point” ) output ranges.
3) Discretizing Scales – mapping continuous domains to discrete output ranges ( “bin-linear” and “bin-ordinal” ).
Default value: please see the scale type table.
- zero : boolean
If
true
, ensures that a zero baseline value is included in the scale domain.Default value:
true
for x and y channels if the quantitative field is not binned and no customdomain
is provided;false
otherwise.Note: Log, time, and utc scales do not support
zero
.
-
class
altair.
ScaleConfig
(bandPaddingInner=Undefined, bandPaddingOuter=Undefined, clamp=Undefined, continuousPadding=Undefined, maxBandSize=Undefined, maxFontSize=Undefined, maxOpacity=Undefined, maxSize=Undefined, maxStrokeWidth=Undefined, minBandSize=Undefined, minFontSize=Undefined, minOpacity=Undefined, minSize=Undefined, minStrokeWidth=Undefined, pointPadding=Undefined, rangeStep=Undefined, round=Undefined, textXRangeStep=Undefined, useUnaggregatedDomain=Undefined, **kwds)¶ ScaleConfig schema wrapper
Mapping(required=[])
Attributes: - bandPaddingInner : float
Default inner padding for
x
andy
band-ordinal scales.Default value:
0.1
- bandPaddingOuter : float
Default outer padding for
x
andy
band-ordinal scales. If not specified, by default, band scale’s paddingOuter is paddingInner/2.- clamp : boolean
If true, values that exceed the data domain are clamped to either the minimum or maximum range value
- continuousPadding : float
Default padding for continuous scales.
Default:
5
for continuous x-scale of a vertical bar and continuous y-scale of a horizontal bar.;0
otherwise.- maxBandSize : float
The default max value for mapping quantitative fields to bar’s size/bandSize.
If undefined (default), we will use the scale’s
rangeStep
- 1.- maxFontSize : float
The default max value for mapping quantitative fields to text’s size/fontSize.
Default value:
40
- maxOpacity : float
Default max opacity for mapping a field to opacity.
Default value:
0.8
- maxSize : float
Default max value for point size scale.
- maxStrokeWidth : float
Default max strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks.
Default value:
4
- minBandSize : float
The default min value for mapping quantitative fields to bar and tick’s size/bandSize scale with zero=false.
Default value:
2
- minFontSize : float
The default min value for mapping quantitative fields to tick’s size/fontSize scale with zero=false
Default value:
8
- minOpacity : float
Default minimum opacity for mapping a field to opacity.
Default value:
0.3
- minSize : float
Default minimum value for point size scale with zero=false.
Default value:
9
- minStrokeWidth : float
Default minimum strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks with zero=false.
Default value:
1
- pointPadding : float
Default outer padding for
x
andy
point-ordinal scales.Default value:
0.5
- rangeStep : anyOf(float, None)
Default range step for band and point scales of (1) the
y
channel and (2) thex
channel when the mark is nottext
.Default value:
21
- round : boolean
If true, rounds numeric output values to integers. This can be helpful for snapping to the pixel grid. (Only available for
x
,y
, andsize
scales.)- textXRangeStep : float
Default range step for
x
band and point scales of text marks.Default value:
90
- useUnaggregatedDomain : boolean
Use the source data range before aggregation as scale domain instead of aggregated data for aggregate axis.
This is equivalent to setting
domain
to"unaggregate"
for aggregated quantitative fields by default.This property only works with aggregate functions that produce values within the raw data domain (
"mean"
,"average"
,"median"
,"q1"
,"q3"
,"min"
,"max"
). For other aggregations that produce values outside of the raw data domain (e.g."count"
,"sum"
), this property is ignored.Default value:
false
-
class
altair.
ScaleInterpolate
(*args)¶ ScaleInterpolate schema wrapper
enum(‘rgb’, ‘lab’, ‘hcl’, ‘hsl’, ‘hsl-long’, ‘hcl-long’, ‘cubehelix’, ‘cubehelix-long’)
-
class
altair.
ScaleInterpolateParams
(type=Undefined, gamma=Undefined, **kwds)¶ ScaleInterpolateParams schema wrapper
Mapping(required=[type])
Attributes: - type : enum(‘rgb’, ‘cubehelix’, ‘cubehelix-long’)
- gamma : float
-
class
altair.
ScaleResolveMap
(color=Undefined, fill=Undefined, opacity=Undefined, shape=Undefined, size=Undefined, stroke=Undefined, x=Undefined, y=Undefined, **kwds)¶ ScaleResolveMap schema wrapper
Mapping(required=[])
Attributes: - color : ResolveMode
- fill : ResolveMode
- opacity : ResolveMode
- shape : ResolveMode
- size : ResolveMode
- stroke : ResolveMode
- x : ResolveMode
- y : ResolveMode
-
class
altair.
ScaleType
(*args)¶ ScaleType schema wrapper
enum(‘linear’, ‘bin-linear’, ‘log’, ‘pow’, ‘sqrt’, ‘time’, ‘utc’, ‘sequential’, ‘ordinal’, ‘bin-ordinal’, ‘point’, ‘band’)
-
class
altair.
SchemaBase
(*args, **kwds)¶ Base class for schema wrappers.
Each derived class should set the _schema class attribute (and optionally the _rootschema class attribute) which is used for validation.
-
copy
(deep=True, ignore=())¶ Return a copy of the object
Parameters: - deep : boolean, optional
if True (default) then return a deep copy of all dict, list, and SchemaBase objects within the object structure
- ignore : list, optional
A list of keys for which the contents should not be copied, but only stored by reference.
-
classmethod
from_dict
(dct, validate=True, _wrapper_classes=None)¶ Construct class from a dictionary representation
Parameters: - dct : dictionary
The dict from which to construct the class
- validate : boolean
If True (default), then validate the input against the schema.
- _wrapper_classes : list (optional)
The set of SchemaBase classes to use when constructing wrappers of the dict inputs. If not specified, the result of cls._default_wrapper_classes will be used.
Returns: - obj : Schema object
The wrapped schema
Raises: - jsonschema.ValidationError :
if validate=True and dct does not conform to the schema
-
classmethod
from_json
(json_string, validate=True, **kwargs)¶ Instantiate the object from a valid JSON string
Parameters: - json_string : string
The string containing a valid JSON chart specification.
- validate : boolean
If True (default), then validate the input against the schema.
- **kwargs :
Additional keyword arguments are passed to json.loads
Returns: - chart : Chart object
The altair Chart object built from the specification.
-
classmethod
resolve_references
(schema)¶ Resolve references of the schema the context of this object’s schema
-
to_dict
(validate=True, ignore=[], context={})¶ Return a dictionary representation of the object
Parameters: - validate : boolean or string
If True (default), then validate the output dictionary against the schema. If “deep” then recursively validate all objects in the spec. This takes much more time, but it results in friendlier tracebacks for large objects.
- ignore : list
A list of keys to ignore. This will not passed to child to_dict function calls.
- context : dict (optional)
A context dictionary that will be passed to all child to_dict function calls
Returns: - dct : dictionary
The dictionary representation of this object
Raises: - jsonschema.ValidationError :
if validate=True and the dict does not conform to the schema
-
to_json
(validate=True, ignore=[], context={}, indent=2, sort_keys=True, **kwargs)¶ Emit the JSON representation for this object as a string.
Parameters: - validate : boolean or string
If True (default), then validate the output dictionary against the schema. If “deep” then recursively validate all objects in the spec. This takes much more time, but it results in friendlier tracebacks for large objects.
- ignore : list
A list of keys to ignore. This will not passed to child to_dict function calls.
- context : dict (optional)
A context dictionary that will be passed to all child to_dict function calls
- indent : integer, default 2
the number of spaces of indentation to use
- sort_keys : boolean, default True
if True, sort keys in the output
- **kwargs
Additional keyword arguments are passed to
json.dumps()
Returns: - spec : string
The JSON specification of the chart object.
-
classmethod
validate
(instance, schema=None)¶ Validate the instance against the class schema in the context of the rootschema.
-
-
class
altair.
SchemeParams
(name=Undefined, extent=Undefined, **kwds)¶ SchemeParams schema wrapper
Mapping(required=[name])
Attributes: - name : string
A color scheme name for sequential/ordinal scales (e.g.,
"category10"
or"viridis"
).For the full list of supported schemes, please refer to the Vega Scheme reference.
- extent : List(float)
For sequential and diverging schemes only, determines the extent of the color range to use. For example
[0.2, 1]
will rescale the color scheme such that color values in the range [0, 0.2) are excluded from the scheme.
-
class
altair.
SelectionAnd
(**kwds)¶ SelectionAnd schema wrapper
Mapping(required=[and])
Attributes: - and : List(SelectionOperand)
-
class
altair.
SelectionConfig
(interval=Undefined, multi=Undefined, single=Undefined, **kwds)¶ SelectionConfig schema wrapper
Mapping(required=[])
Attributes: - interval : IntervalSelectionConfig
The default definition for an interval selection. All properties and transformations for an interval selection definition (except
type
) may be specified here.For instance, setting
interval
to{"translate": false}
disables the ability to move interval selections by default.- multi : MultiSelectionConfig
The default definition for a multi selection. All properties and transformations for a multi selection definition (except
type
) may be specified here.For instance, setting
multi
to{"toggle": "event.altKey"}
adds additional values to multi selections when clicking with the alt-key pressed by default.- single : SingleSelectionConfig
The default definition for a single selection. All properties and transformations for a single selection definition (except
type
) may be specified here.For instance, setting
single
to{"on": "dblclick"}
populates single selections on double-click by default.
-
class
altair.
SelectionDef
(*args, **kwds)¶ SelectionDef schema wrapper
anyOf(SingleSelection, MultiSelection, IntervalSelection)
-
class
altair.
SelectionDomain
(*args, **kwds)¶ SelectionDomain schema wrapper
anyOf(Mapping(required=[selection]), Mapping(required=[selection]))
-
class
altair.
SelectionMapping
(*args, **kwds)¶ A mapping of selection names to selection definitions.
This is designed to match the schema of the “selection” property of top-level objects.
-
class
altair.
SelectionNot
(**kwds)¶ SelectionNot schema wrapper
Mapping(required=[not])
Attributes: - not : SelectionOperand
-
class
altair.
SelectionOperand
(*args, **kwds)¶ SelectionOperand schema wrapper
anyOf(SelectionNot, SelectionAnd, SelectionOr, string)
-
class
altair.
SelectionOr
(**kwds)¶ SelectionOr schema wrapper
Mapping(required=[or])
Attributes: - or : List(SelectionOperand)
-
class
altair.
SelectionPredicate
(selection=Undefined, **kwds)¶ SelectionPredicate schema wrapper
Mapping(required=[selection])
Attributes: - selection : SelectionOperand
Filter using a selection name.
-
class
altair.
SelectionResolution
(*args)¶ SelectionResolution schema wrapper
enum(‘global’, ‘union’, ‘intersect’)
-
class
altair.
Shape
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds) Shape schema wrapper
Mapping(required=[shorthand]) A FieldDef with Condition
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- legend : anyOf(Legend, None)
An object defining properties of the legend. If
null
, the legend for the encoding channel will be removed.Default value: If undefined, default legend properties are applied.
- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
ShapeValue
(value, condition=Undefined, **kwds) ShapeValue schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalMarkPropFieldDef, ConditionalValueDef,
- List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
SingleDefChannel
(*args)¶ SingleDefChannel schema wrapper
enum(‘x’, ‘y’, ‘x2’, ‘y2’, ‘longitude’, ‘latitude’, ‘longitude2’, ‘latitude2’, ‘row’, ‘column’, ‘color’, ‘fill’, ‘stroke’, ‘size’, ‘shape’, ‘opacity’, ‘text’, ‘tooltip’, ‘href’, ‘key’)
-
class
altair.
SingleSelection
(type=Undefined, bind=Undefined, empty=Undefined, encodings=Undefined, fields=Undefined, nearest=Undefined, on=Undefined, resolve=Undefined, **kwds)¶ SingleSelection schema wrapper
Mapping(required=[type])
Attributes: - type : enum(‘single’)
- bind : anyOf(VgBinding, Mapping(required=[]))
Establish a two-way binding between a single selection and input elements (also known as dynamic query widgets). A binding takes the form of Vega’s input element binding definition or can be a mapping between projected field/encodings and binding definitions.
See the bind transform documentation for more information.
- empty : enum(‘all’, ‘none’)
By default, all data values are considered to lie within an empty selection. When set to
none
, empty selections contain no data values.- encodings : List(SingleDefChannel)
An array of encoding channels. The corresponding data field values must match for a data tuple to fall within the selection.
- fields : List(string)
An array of field names whose values must match for a data tuple to fall within the selection.
- nearest : boolean
When true, an invisible voronoi diagram is computed to accelerate discrete selection. The data value nearest the mouse cursor is added to the selection.
See the nearest transform documentation for more information.
- on : VgEventStream
A Vega event stream (object or selector) that triggers the selection. For interval selections, the event stream must specify a start and end.
- resolve : SelectionResolution
With layered and multi-view displays, a strategy that determines how selections’ data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain.
-
class
altair.
SingleSelectionConfig
(bind=Undefined, empty=Undefined, encodings=Undefined, fields=Undefined, nearest=Undefined, on=Undefined, resolve=Undefined, **kwds)¶ SingleSelectionConfig schema wrapper
Mapping(required=[])
Attributes: - bind : anyOf(VgBinding, Mapping(required=[]))
Establish a two-way binding between a single selection and input elements (also known as dynamic query widgets). A binding takes the form of Vega’s input element binding definition or can be a mapping between projected field/encodings and binding definitions.
See the bind transform documentation for more information.
- empty : enum(‘all’, ‘none’)
By default, all data values are considered to lie within an empty selection. When set to
none
, empty selections contain no data values.- encodings : List(SingleDefChannel)
An array of encoding channels. The corresponding data field values must match for a data tuple to fall within the selection.
- fields : List(string)
An array of field names whose values must match for a data tuple to fall within the selection.
- nearest : boolean
When true, an invisible voronoi diagram is computed to accelerate discrete selection. The data value nearest the mouse cursor is added to the selection.
See the nearest transform documentation for more information.
- on : VgEventStream
A Vega event stream (object or selector) that triggers the selection. For interval selections, the event stream must specify a start and end.
- resolve : SelectionResolution
With layered and multi-view displays, a strategy that determines how selections’ data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain.
-
class
altair.
SingleTimeUnit
(*args, **kwds)¶ SingleTimeUnit schema wrapper
anyOf(LocalSingleTimeUnit, UtcSingleTimeUnit)
-
class
altair.
Size
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds) Size schema wrapper
Mapping(required=[shorthand]) A FieldDef with Condition
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- legend : anyOf(Legend, None)
An object defining properties of the legend. If
null
, the legend for the encoding channel will be removed.Default value: If undefined, default legend properties are applied.
- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
SizeValue
(value, condition=Undefined, **kwds) SizeValue schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalMarkPropFieldDef, ConditionalValueDef,
- List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
Sort
(*args, **kwds)¶ Sort schema wrapper
anyOf(List(float), List(string), List(boolean), List(DateTime), SortOrder, EncodingSortField, None)
-
class
altair.
SortField
(field=Undefined, order=Undefined, **kwds)¶ SortField schema wrapper
Mapping(required=[field]) A sort definition for transform
Attributes: - field : string
The name of the field to sort.
- order : VgComparatorOrder
Whether to sort the field in ascending or descending order.
-
class
altair.
SortOrder
(*args, **kwds)¶ SortOrder schema wrapper
anyOf(VgComparatorOrder, None)
-
class
altair.
Spec
(*args, **kwds)¶ Spec schema wrapper
anyOf(CompositeUnitSpec, LayerSpec, FacetSpec, RepeatSpec, VConcatSpec, HConcatSpec)
-
class
altair.
StackOffset
(*args)¶ StackOffset schema wrapper
enum(‘zero’, ‘center’, ‘normalize’)
-
class
altair.
Stroke
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds)¶ Stroke schema wrapper
Mapping(required=[shorthand]) A FieldDef with Condition
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- legend : anyOf(Legend, None)
An object defining properties of the legend. If
null
, the legend for the encoding channel will be removed.Default value: If undefined, default legend properties are applied.
- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
StrokeCap
(*args)¶ StrokeCap schema wrapper
enum(‘butt’, ‘round’, ‘square’)
-
class
altair.
StrokeJoin
(*args)¶ StrokeJoin schema wrapper
enum(‘miter’, ‘round’, ‘bevel’)
-
class
altair.
StrokeValue
(value, condition=Undefined, **kwds)¶ StrokeValue schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalMarkPropFieldDef, ConditionalValueDef,
- List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
StyleConfigIndex
(**kwds)¶ StyleConfigIndex schema wrapper
Mapping(required=[])
-
class
altair.
Text
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, format=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds) Text schema wrapper
Mapping(required=[shorthand]) A FieldDef with Condition
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- format : string
The formatting pattern for a text field. If not defined, this will be determined automatically.
- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
TextBaseline
(*args, **kwds)¶ TextBaseline schema wrapper
anyOf(enum(‘alphabetic’), Baseline)
-
class
altair.
TextConfig
(align=Undefined, angle=Undefined, baseline=Undefined, color=Undefined, cornerRadius=Undefined, cursor=Undefined, dir=Undefined, dx=Undefined, dy=Undefined, ellipsis=Undefined, fill=Undefined, fillOpacity=Undefined, filled=Undefined, font=Undefined, fontSize=Undefined, fontStyle=Undefined, fontWeight=Undefined, href=Undefined, interpolate=Undefined, limit=Undefined, opacity=Undefined, orient=Undefined, radius=Undefined, shape=Undefined, shortTimeLabels=Undefined, size=Undefined, stroke=Undefined, strokeCap=Undefined, strokeDash=Undefined, strokeDashOffset=Undefined, strokeJoin=Undefined, strokeMiterLimit=Undefined, strokeOpacity=Undefined, strokeWidth=Undefined, tension=Undefined, text=Undefined, theta=Undefined, tooltip=Undefined, **kwds)¶ TextConfig schema wrapper
Mapping(required=[])Attributes: - align : HorizontalAlign
The horizontal alignment of the text. One of
"left"
,"right"
,"center"
.- angle : float
The rotation angle of the text, in degrees.
- baseline : VerticalAlign
The vertical alignment of the text. One of
"top"
,"middle"
,"bottom"
.Default value:
"middle"
- color : string
Default color. Note that
fill
andstroke
have higher precedence thancolor
and will overridecolor
.Default value: ■
"#4682b4"
Note: This property cannot be used in a style config.
- cornerRadius : float
The radius in pixels of rounded rectangle corners. Default value:
0
- cursor : Cursor
The mouse cursor used over the mark. Any valid CSS cursor type can be used.
- dir : Dir
The direction of the text. One of
"ltr"
(left-to-right) or"rtl"
(right-to-left). This property determines on which side is truncated in response to the limit parameter. Default value:"ltr"
- dx : float
The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- dy : float
The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- ellipsis : string
The ellipsis string for text truncated in response to the limit parameter. Default value:
"…"
- fill : string
Default Fill Color. This has higher precedence than
config.color
Default value: (None)
- fillOpacity : float
The fill opacity (value between [0,1]).
Default value:
1
- filled : boolean
Whether the mark’s color should be used as fill color instead of stroke color.
Default value:
true
for all marks exceptpoint
andfalse
forpoint
.Applicable for:
bar
,point
,circle
,square
, andarea
marks.Note: This property cannot be used in a style config.
- font : string
The typeface to set the text in (e.g.,
"Helvetica Neue"
).- fontSize : float
The font size, in pixels.
- fontStyle : FontStyle
The font style (e.g.,
"italic"
).- fontWeight : FontWeight
The font weight. This can be either a string (e.g
"bold"
,"normal"
) or a number (100
,200
,300
, …,900
where"normal"
=400
and"bold"
=700
).- href : string
A URL to load upon mouse click. If defined, the mark acts as a hyperlink.
- interpolate : Interpolate
The line interpolation method to use for line and area marks. One of the following:
"linear"
: piecewise linear segments, as in a polyline."linear-closed"
: close the linear segments to form a polygon."step"
: alternate between horizontal and vertical segments, as in a step function."step-before"
: alternate between vertical and horizontal segments, as in a step function."step-after"
: alternate between horizontal and vertical segments, as in a step function."basis"
: a B-spline, with control point duplication on the ends."basis-open"
: an open B-spline; may not intersect the start or end."basis-closed"
: a closed B-spline, as in a loop."cardinal"
: a Cardinal spline, with control point duplication on the ends."cardinal-open"
: an open Cardinal spline; may not intersect the start or end, but will intersect other control points."cardinal-closed"
: a closed Cardinal spline, as in a loop."bundle"
: equivalent to basis, except the tension parameter is used to straighten the spline."monotone"
: cubic interpolation that preserves monotonicity in y.
- limit : float
The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. Default value:
0
, indicating no limit- opacity : float
The overall opacity (value between [0,1]).
Default value:
0.7
for non-aggregate plots withpoint
,tick
,circle
, orsquare
marks or layeredbar
charts and1
otherwise.- orient : Orient
The orientation of a non-stacked bar, tick, area, and line charts. The value is either horizontal (default) or vertical.
- For bar, rule and tick, this determines whether the size of the bar and tick
should be applied to x or y dimension. * For area, this property determines the orient property of the Vega output. * For line and trail marks, this property determines the sort order of the points in
the line
if
config.sortLineBy
is not specified. For stacked charts, this is always determined by the orientation of the stack; therefore explicitly specified value will be ignored.- radius : float
Polar coordinate radial offset, in pixels, of the text label from the origin determined by the
x
andy
properties.- shape : string
The default symbol shape to use. One of:
"circle"
(default),"square"
,"cross"
,"diamond"
,"triangle-up"
, or"triangle-down"
, or a custom SVG path.Default value:
"circle"
- shortTimeLabels : boolean
Whether month names and weekday names should be abbreviated.
- size : float
The pixel area each the point/circle/square. For example: in the case of circles, the radius is determined in part by the square root of the size value.
Default value:
30
stroke : string
- <<<<<<< HEAD
Default Stroke Color. This has higher precedence than
config.color
Default value: (None)
strokeCap : enum(‘butt’, ‘round’, ‘square’)
- =======
Default Stroke Color. This has higher precedence than
config.color
Default value: (None)strokeCap : StrokeCap
- >>>>>>> altair-viz/master
The stroke cap for line ending style. One of
"butt"
,"round"
, or"square"
.Default value:
"square"
- strokeDash : List(float)
An array of alternating stroke, space lengths for creating dashed or dotted lines.
- strokeDashOffset : float
The offset (in pixels) into which to begin drawing with the stroke dash array.
- strokeJoin : StrokeJoin
The stroke line join method. One of
"miter"
,"round"
or"bevel"
. Default value:"miter"
- strokeMiterLimit : float
The miter limit at which to bevel a line join.
- strokeOpacity : float
The stroke opacity (value between [0,1]).
Default value:
1
- strokeWidth : float
The stroke width, in pixels.
- tension : float
Depending on the interpolation type, sets the tension parameter (for line and area marks).
- text : string
Placeholder text if the
text
channel is not specified- theta : float
Polar coordinate angle, in radians, of the text label from the origin determined by the
x
andy
properties. Values fortheta
follow the same convention ofarc
markstartAngle
andendAngle
properties: angles are measured in radians, with0
indicating “north”.- tooltip : Mapping(required=[])
The tooltip text to show upon mouse hover.
-
class
altair.
TextFieldDef
(type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, format=Undefined, timeUnit=Undefined, title=Undefined, **kwds)¶ TextFieldDef schema wrapper
Mapping(required=[type])
Attributes: - type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- format : string
The formatting pattern for a text field. If not defined, this will be determined automatically.
- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.
-
class
altair.
TextFieldDefWithCondition
(type=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, format=Undefined, timeUnit=Undefined, title=Undefined, **kwds)¶ TextFieldDefWithCondition schema wrapper
Mapping(required=[type]) A FieldDef with Condition
Attributes: - type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- format : string
The formatting pattern for a text field. If not defined, this will be determined automatically.
- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.
-
class
altair.
TextValue
(value, condition=Undefined, **kwds) TextValue schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalTextFieldDef, ConditionalValueDef, List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
TextValueDefWithCondition
(condition=Undefined, value=Undefined, **kwds)¶ TextValueDefWithCondition schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalTextFieldDef, ConditionalValueDef, List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
TickConfig
(align=Undefined, angle=Undefined, bandSize=Undefined, baseline=Undefined, color=Undefined, cornerRadius=Undefined, cursor=Undefined, dir=Undefined, dx=Undefined, dy=Undefined, ellipsis=Undefined, fill=Undefined, fillOpacity=Undefined, filled=Undefined, font=Undefined, fontSize=Undefined, fontStyle=Undefined, fontWeight=Undefined, href=Undefined, interpolate=Undefined, limit=Undefined, opacity=Undefined, orient=Undefined, radius=Undefined, shape=Undefined, size=Undefined, stroke=Undefined, strokeCap=Undefined, strokeDash=Undefined, strokeDashOffset=Undefined, strokeJoin=Undefined, strokeMiterLimit=Undefined, strokeOpacity=Undefined, strokeWidth=Undefined, tension=Undefined, text=Undefined, theta=Undefined, thickness=Undefined, tooltip=Undefined, **kwds)¶ TickConfig schema wrapper
Mapping(required=[])Attributes: - align : HorizontalAlign
The horizontal alignment of the text. One of
"left"
,"right"
,"center"
.- angle : float
The rotation angle of the text, in degrees.
- bandSize : float
The width of the ticks.
Default value: 2/3 of rangeStep.
- baseline : VerticalAlign
The vertical alignment of the text. One of
"top"
,"middle"
,"bottom"
.Default value:
"middle"
- color : string
Default color. Note that
fill
andstroke
have higher precedence thancolor
and will overridecolor
.Default value: ■
"#4682b4"
Note: This property cannot be used in a style config.
- cornerRadius : float
The radius in pixels of rounded rectangle corners. Default value:
0
- cursor : Cursor
The mouse cursor used over the mark. Any valid CSS cursor type can be used.
- dir : Dir
The direction of the text. One of
"ltr"
(left-to-right) or"rtl"
(right-to-left). This property determines on which side is truncated in response to the limit parameter. Default value:"ltr"
- dx : float
The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- dy : float
The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- ellipsis : string
The ellipsis string for text truncated in response to the limit parameter. Default value:
"…"
- fill : string
Default Fill Color. This has higher precedence than
config.color
Default value: (None)
- fillOpacity : float
The fill opacity (value between [0,1]).
Default value:
1
- filled : boolean
Whether the mark’s color should be used as fill color instead of stroke color.
Default value:
true
for all marks exceptpoint
andfalse
forpoint
.Applicable for:
bar
,point
,circle
,square
, andarea
marks.Note: This property cannot be used in a style config.
- font : string
The typeface to set the text in (e.g.,
"Helvetica Neue"
).- fontSize : float
The font size, in pixels.
- fontStyle : FontStyle
The font style (e.g.,
"italic"
).- fontWeight : FontWeight
The font weight. This can be either a string (e.g
"bold"
,"normal"
) or a number (100
,200
,300
, …,900
where"normal"
=400
and"bold"
=700
).- href : string
A URL to load upon mouse click. If defined, the mark acts as a hyperlink.
- interpolate : Interpolate
The line interpolation method to use for line and area marks. One of the following:
"linear"
: piecewise linear segments, as in a polyline."linear-closed"
: close the linear segments to form a polygon."step"
: alternate between horizontal and vertical segments, as in a step function."step-before"
: alternate between vertical and horizontal segments, as in a step function."step-after"
: alternate between horizontal and vertical segments, as in a step function."basis"
: a B-spline, with control point duplication on the ends."basis-open"
: an open B-spline; may not intersect the start or end."basis-closed"
: a closed B-spline, as in a loop."cardinal"
: a Cardinal spline, with control point duplication on the ends."cardinal-open"
: an open Cardinal spline; may not intersect the start or end, but will intersect other control points."cardinal-closed"
: a closed Cardinal spline, as in a loop."bundle"
: equivalent to basis, except the tension parameter is used to straighten the spline."monotone"
: cubic interpolation that preserves monotonicity in y.
- limit : float
The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. Default value:
0
, indicating no limit- opacity : float
The overall opacity (value between [0,1]).
Default value:
0.7
for non-aggregate plots withpoint
,tick
,circle
, orsquare
marks or layeredbar
charts and1
otherwise.- orient : Orient
The orientation of a non-stacked bar, tick, area, and line charts. The value is either horizontal (default) or vertical.
- For bar, rule and tick, this determines whether the size of the bar and tick
should be applied to x or y dimension. * For area, this property determines the orient property of the Vega output. * For line and trail marks, this property determines the sort order of the points in
the line
if
config.sortLineBy
is not specified. For stacked charts, this is always determined by the orientation of the stack; therefore explicitly specified value will be ignored.- radius : float
Polar coordinate radial offset, in pixels, of the text label from the origin determined by the
x
andy
properties.- shape : string
The default symbol shape to use. One of:
"circle"
(default),"square"
,"cross"
,"diamond"
,"triangle-up"
, or"triangle-down"
, or a custom SVG path.Default value:
"circle"
- size : float
The pixel area each the point/circle/square. For example: in the case of circles, the radius is determined in part by the square root of the size value.
Default value:
30
stroke : string
- <<<<<<< HEAD
Default Stroke Color. This has higher precedence than
config.color
Default value: (None)
strokeCap : enum(‘butt’, ‘round’, ‘square’)
- =======
Default Stroke Color. This has higher precedence than
config.color
Default value: (None)strokeCap : StrokeCap
- >>>>>>> altair-viz/master
The stroke cap for line ending style. One of
"butt"
,"round"
, or"square"
.Default value:
"square"
- strokeDash : List(float)
An array of alternating stroke, space lengths for creating dashed or dotted lines.
- strokeDashOffset : float
The offset (in pixels) into which to begin drawing with the stroke dash array.
- strokeJoin : StrokeJoin
The stroke line join method. One of
"miter"
,"round"
or"bevel"
. Default value:"miter"
- strokeMiterLimit : float
The miter limit at which to bevel a line join.
- strokeOpacity : float
The stroke opacity (value between [0,1]).
Default value:
1
- strokeWidth : float
The stroke width, in pixels.
- tension : float
Depending on the interpolation type, sets the tension parameter (for line and area marks).
- text : string
Placeholder text if the
text
channel is not specified- theta : float
Polar coordinate angle, in radians, of the text label from the origin determined by the
x
andy
properties. Values fortheta
follow the same convention ofarc
markstartAngle
andendAngle
properties: angles are measured in radians, with0
indicating “north”.
thickness : float
- <<<<<<< HEAD
Thickness of the tick mark.
Default value:
1
- =======
Thickness of the tick mark. Default value:
1
- tooltip : Mapping(required=[])
The tooltip text to show upon mouse hover.
- >>>>>>> altair-viz/master
-
class
altair.
TimeUnit
(*args, **kwds)¶ TimeUnit schema wrapper
anyOf(SingleTimeUnit, MultiTimeUnit)
-
class
altair.
TimeUnitTransform
(field=Undefined, timeUnit=Undefined, **kwds)¶ TimeUnitTransform schema wrapper
Mapping(required=[timeUnit, field, as])
Attributes: - field : string
The data field to apply time unit.
- timeUnit : TimeUnit
The timeUnit.
- as : string
The output field to write the timeUnit value.
-
class
altair.
TitleOrient
(*args)¶ TitleOrient schema wrapper
enum(‘top’, ‘bottom’, ‘left’, ‘right’)
-
class
altair.
TitleParams
(text=Undefined, anchor=Undefined, offset=Undefined, orient=Undefined, style=Undefined, **kwds)¶ TitleParams schema wrapper
Mapping(required=[text])
Attributes: - text : string
The title text.
- anchor : Anchor
The anchor position for placing the title. One of
"start"
,"middle"
, or"end"
. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title.Default value:
"middle"
for single and layered views."start"
for other composite views.Note: For now,
anchor
is only customizable only for single and layered views. For other composite views,anchor
is always"start"
.- offset : float
The orthogonal offset in pixels by which to displace the title from its position along the edge of the chart.
- orient : TitleOrient
The orientation of the title relative to the chart. One of
"top"
(the default),"bottom"
,"left"
, or"right"
.- style : anyOf(string, List(string))
A mark style property to apply to the title text mark.
Default value:
"group-title"
.
-
class
altair.
Tooltip
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, format=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds) Tooltip schema wrapper
Mapping(required=[shorthand]) A FieldDef with Condition
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- condition : anyOf(ConditionalValueDef, List(ConditionalValueDef))
One or more value definition(s) with a selection predicate.
Note: A field definition’s
condition
property can only contain value definitions since Vega-Lite only allows at most one encoded field per encoding channel.- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- format : string
The formatting pattern for a text field. If not defined, this will be determined automatically.
- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
TooltipValue
(value, condition=Undefined, **kwds) TooltipValue schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalTextFieldDef, ConditionalValueDef, List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
TopLevelFacetSpec
(data=Undefined, facet=Undefined, spec=Undefined, align=Undefined, autosize=Undefined, background=Undefined, bounds=Undefined, center=Undefined, config=Undefined, datasets=Undefined, description=Undefined, name=Undefined, padding=Undefined, resolve=Undefined, spacing=Undefined, title=Undefined, transform=Undefined, **kwds)¶ TopLevelFacetSpec schema wrapper
Mapping(required=[data, facet, spec])Attributes: - data : Data
An object describing the data source
- facet : FacetMapping
An object that describes mappings between
row
andcolumn
channels and their field definitions.- spec : anyOf(LayerSpec, CompositeUnitSpec)
A specification of the view that gets faceted.
- align : anyOf(VgLayoutAlign, RowColVgLayoutAlign)
The alignment to apply to grid rows and columns. 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. Alternatively, an object value of the form{"row": string, "column": string}
canbe used to supply different alignments for rows and columns. Default value:
"all"
.- autosize : anyOf(AutosizeType, AutoSizeParams)
Sets how the visualization size should be determined. If a string, should be one of
"pad"
,"fit"
or"none"
. Object values can additionally specify parameters for content sizing and automatic resizing."fit"
is only supported for single and layered views that don’t userangeStep
.Default value :
pad
background : string
- <<<<<<< HEAD
CSS color property to use as the background of visualization.
Default value: none (transparent)
- =======
CSS color property to use as the background of visualization. Default value: none (transparent)
- bounds : enum(‘full’, ‘flush’)
The bounds calculation method to use for determining the extent of a sub-plot. One of
full
(the default) orflush
. * If set tofull
, the entire calculated bounds (including axes, title, and legend) will be used. * If set toflush
, only the specified width and height values for the sub-view will be used.The
flush
setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. Default value:"full"
- center : anyOf(boolean, RowColboolean)
Boolean flag indicating if subviews should be centered relative to their respective rows or columns. An object value of the form
{"row": boolean, "column": boolean}
can be used to supply different centering values for rows and columns. Default value:false
- >>>>>>> altair-viz/master
- config : Config
Vega-Lite configuration object. This property can only be defined at the top-level of a specification.
- datasets : Datasets
A global data store for named datasets. This is a mapping from names to inline datasets. This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a
data
property.- description : string
Description of this mark for commenting purpose.
- name : string
Name of the visualization for later reference.
- padding : Padding
The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format
{"left": 5, "top": 5, "right": 5, "bottom": 5}
to specify padding for each side of the visualization.Default value :
5
- resolve : Resolve
Scale, axis, and legend resolutions for facets.
- spacing : anyOf(float, RowColnumber)
The spacing in pixels between sub-views of the composition operator. An object of the form
{"row": number, "column": number}
can be used to set different spacing values for rows and columns. Default value :10
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- $schema : string
URL to JSON schema for a Vega-Lite specification. Unless you have a reason to change this, use
https://vega.github.io/schema/vega-lite/v2.json
. Setting the$schema
property allows automatic validation and autocomplete in editors that support JSON schema.
-
class
altair.
TopLevelFacetedUnitSpec
(data=Undefined, mark=Undefined, autosize=Undefined, background=Undefined, config=Undefined, datasets=Undefined, description=Undefined, encoding=Undefined, height=Undefined, name=Undefined, padding=Undefined, projection=Undefined, selection=Undefined, title=Undefined, transform=Undefined, width=Undefined, **kwds)¶ TopLevelFacetedUnitSpec schema wrapper
Mapping(required=[data, mark])
Attributes: - data : Data
An object describing the data source
- mark : AnyMark
A string describing the mark type (one of
"bar"
,"circle"
,"square"
,"tick"
,"line"
,"area"
,"point"
,"rule"
,"geoshape"
, and"text"
) or a mark definition object.- autosize : anyOf(AutosizeType, AutoSizeParams)
Sets how the visualization size should be determined. If a string, should be one of
"pad"
,"fit"
or"none"
. Object values can additionally specify parameters for content sizing and automatic resizing."fit"
is only supported for single and layered views that don’t userangeStep
.Default value :
pad
- background : string
CSS color property to use as the background of visualization.
Default value: none (transparent)
- config : Config
Vega-Lite configuration object. This property can only be defined at the top-level of a specification.
- datasets : Datasets
A global data store for named datasets. This is a mapping from names to inline datasets. This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a
data
property.- description : string
Description of this mark for commenting purpose.
- encoding : EncodingWithFacet
A key-value mapping between encoding channels and definition of fields.
- height : float
The height of a visualization.
Default value:
- If a view’s autosize
type is
"fit"
or its y-channel has a continuous scale, the height will be the value of config.view.height. - For y-axis with a band or point scale: if rangeStep is a numeric value or
unspecified, the height is determined by the range step, paddings, and the
cardinality of the field mapped to y-channel. Otherwise, if the
rangeStep
isnull
, the height will be the value of config.view.height. - If no field is mapped to
y
channel, theheight
will be the value ofrangeStep
.
Note : For plots with row and column channels, this represents the height of a single view.
See also: The documentation for width and height contains more examples.
- If a view’s autosize
type is
- name : string
Name of the visualization for later reference.
- padding : Padding
The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format
{"left": 5, "top": 5, "right": 5, "bottom": 5}
to specify padding for each side of the visualization.Default value :
5
- projection : Projection
An object defining properties of geographic projection, which will be applied to
shape
path for"geoshape"
marks and tolatitude
and"longitude"
channels for other marks.- selection : Mapping(required=[])
A key-value mapping between selection names and definitions.
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- width : float
The width of a visualization.
Default value: This will be determined by the following rules:
- If a view’s autosize
type is
"fit"
or its x-channel has a continuous scale, the width will be the value of config.view.width. - For x-axis with a band or point scale: if rangeStep is a numeric value or
unspecified, the width is determined by the range step, paddings, and the
cardinality of the field mapped to x-channel. Otherwise, if the
rangeStep
isnull
, the width will be the value of config.view.width. - If no field is mapped to
x
channel, thewidth
will be the value of config.scale.textXRangeStep fortext
mark and the value ofrangeStep
for other marks.
Note: For plots with row and column channels, this represents the width of a single view.
See also: The documentation for width and height contains more examples.
- If a view’s autosize
type is
- $schema : string
URL to JSON schema for a Vega-Lite specification. Unless you have a reason to change this, use
https://vega.github.io/schema/vega-lite/v2.json
. Setting the$schema
property allows automatic validation and autocomplete in editors that support JSON schema.
-
class
altair.
TopLevelHConcatSpec
(hconcat=Undefined, autosize=Undefined, background=Undefined, bounds=Undefined, center=Undefined, config=Undefined, data=Undefined, datasets=Undefined, description=Undefined, name=Undefined, padding=Undefined, resolve=Undefined, spacing=Undefined, title=Undefined, transform=Undefined, **kwds)¶ TopLevelHConcatSpec schema wrapper
Mapping(required=[hconcat])Attributes: - hconcat : List(Spec)
A list of views that should be concatenated and put into a row.
- autosize : anyOf(AutosizeType, AutoSizeParams)
Sets how the visualization size should be determined. If a string, should be one of
"pad"
,"fit"
or"none"
. Object values can additionally specify parameters for content sizing and automatic resizing."fit"
is only supported for single and layered views that don’t userangeStep
.Default value :
pad
background : string
- <<<<<<< HEAD
CSS color property to use as the background of visualization.
Default value: none (transparent)
- =======
CSS color property to use as the background of visualization. Default value: none (transparent)
- bounds : enum(‘full’, ‘flush’)
The bounds calculation method to use for determining the extent of a sub-plot. One of
full
(the default) orflush
. * If set tofull
, the entire calculated bounds (including axes, title, and legend) will be used. * If set toflush
, only the specified width and height values for the sub-view will be used.The
flush
setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. Default value:"full"
- center : boolean
Boolean flag indicating if subviews should be centered relative to their respective rows or columns. Default value:
false
- >>>>>>> altair-viz/master
- config : Config
Vega-Lite configuration object. This property can only be defined at the top-level of a specification.
- data : Data
An object describing the data source
- datasets : Datasets
A global data store for named datasets. This is a mapping from names to inline datasets. This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a
data
property.- description : string
Description of this mark for commenting purpose.
- name : string
Name of the visualization for later reference.
- padding : Padding
The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format
{"left": 5, "top": 5, "right": 5, "bottom": 5}
to specify padding for each side of the visualization.Default value :
5
- resolve : Resolve
Scale, axis, and legend resolutions for horizontally concatenated charts.
- spacing : float
- The spacing in pixels between sub-views of the concat operator. Default value :
10
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- $schema : string
URL to JSON schema for a Vega-Lite specification. Unless you have a reason to change this, use
https://vega.github.io/schema/vega-lite/v2.json
. Setting the$schema
property allows automatic validation and autocomplete in editors that support JSON schema.
-
class
altair.
TopLevelLayerSpec
(layer=Undefined, autosize=Undefined, background=Undefined, config=Undefined, data=Undefined, datasets=Undefined, description=Undefined, encoding=Undefined, height=Undefined, name=Undefined, padding=Undefined, projection=Undefined, resolve=Undefined, title=Undefined, transform=Undefined, width=Undefined, **kwds)¶ TopLevelLayerSpec schema wrapper
Mapping(required=[layer])
Attributes: - layer : List(anyOf(LayerSpec, CompositeUnitSpec))
Layer or single view specifications to be layered.
Note : Specifications inside
layer
cannot userow
andcolumn
channels as layering facet specifications is not allowed.- autosize : anyOf(AutosizeType, AutoSizeParams)
Sets how the visualization size should be determined. If a string, should be one of
"pad"
,"fit"
or"none"
. Object values can additionally specify parameters for content sizing and automatic resizing."fit"
is only supported for single and layered views that don’t userangeStep
.Default value :
pad
- background : string
CSS color property to use as the background of visualization.
Default value: none (transparent)
- config : Config
Vega-Lite configuration object. This property can only be defined at the top-level of a specification.
- data : Data
An object describing the data source
- datasets : Datasets
A global data store for named datasets. This is a mapping from names to inline datasets. This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a
data
property.- description : string
Description of this mark for commenting purpose.
- encoding : Encoding
A shared key-value mapping between encoding channels and definition of fields in the underlying layers.
- height : float
The height of a visualization.
Default value:
- If a view’s autosize
type is
"fit"
or its y-channel has a continuous scale, the height will be the value of config.view.height. - For y-axis with a band or point scale: if rangeStep is a numeric value or
unspecified, the height is determined by the range step, paddings, and the
cardinality of the field mapped to y-channel. Otherwise, if the
rangeStep
isnull
, the height will be the value of config.view.height. - If no field is mapped to
y
channel, theheight
will be the value ofrangeStep
.
Note : For plots with row and column channels, this represents the height of a single view.
See also: The documentation for width and height contains more examples.
- If a view’s autosize
type is
- name : string
Name of the visualization for later reference.
- padding : Padding
The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format
{"left": 5, "top": 5, "right": 5, "bottom": 5}
to specify padding for each side of the visualization.Default value :
5
- projection : Projection
An object defining properties of the geographic projection shared by underlying layers.
- resolve : Resolve
Scale, axis, and legend resolutions for layers.
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- width : float
The width of a visualization.
Default value: This will be determined by the following rules:
- If a view’s autosize
type is
"fit"
or its x-channel has a continuous scale, the width will be the value of config.view.width. - For x-axis with a band or point scale: if rangeStep is a numeric value or
unspecified, the width is determined by the range step, paddings, and the
cardinality of the field mapped to x-channel. Otherwise, if the
rangeStep
isnull
, the width will be the value of config.view.width. - If no field is mapped to
x
channel, thewidth
will be the value of config.scale.textXRangeStep fortext
mark and the value ofrangeStep
for other marks.
Note: For plots with row and column channels, this represents the width of a single view.
See also: The documentation for width and height contains more examples.
- If a view’s autosize
type is
- $schema : string
URL to JSON schema for a Vega-Lite specification. Unless you have a reason to change this, use
https://vega.github.io/schema/vega-lite/v2.json
. Setting the$schema
property allows automatic validation and autocomplete in editors that support JSON schema.
-
class
altair.
TopLevelMixin
¶ Mixin for top-level chart objects such as Chart, LayeredChart, etc.
-
add_selection
(*selections)¶ Add one or more selections to the chart
-
display
(renderer=Undefined, theme=Undefined, actions=Undefined, **kwargs)¶ Display chart in Jupyter notebook or JupyterLab
Parameters are passed as options to vega-embed within supported frontends. See https://github.com/vega/vega-embed#options for details.
Parameters: - renderer : string (‘canvas’ or ‘svg’)
The renderer to use
- theme : string
The Vega theme name to use; see https://github.com/vega/vega-themes
- actions : bool or dict
Specify whether action links (“Open In Vega Editor”, etc.) are included in the view.
- **kwargs :
Additional parameters are also passed to vega-embed as options.
-
project
(type='mercator', center=Undefined, clipAngle=Undefined, clipExtent=Undefined, coefficient=Undefined, distance=Undefined, fraction=Undefined, lobes=Undefined, parallel=Undefined, precision=Undefined, radius=Undefined, ratio=Undefined, rotate=Undefined, spacing=Undefined, tilt=Undefined, **kwds)¶ Add a geographic projection to the chartself.
This is generally used either with
mark_geoshape
or with thelatitude
/longitude
encodings.Available projection types are [‘albers’, ‘albersUsa’, ‘azimuthalEqualArea’, ‘azimuthalEquidistant’,
‘conicConformal’, ‘conicEqualArea’, ‘conicEquidistant’, ‘equirectangular’, ‘gnomonic’, ‘mercator’, ‘orthographic’, ‘stereographic’, ‘transverseMercator’]Attributes: - type : ProjectionType
The cartographic projection to use. This value is case-insensitive, for example “albers” and “Albers” indicate the same projection type. You can find all valid projection types [in the documentation](https://vega.github.io/vega-lite/docs/projection.html#projection-types).
Default value: mercator
- center : List(float)
Sets the projection’s center to the specified center, a two-element array of longitude and latitude in degrees.
Default value: [0, 0]
- clipAngle : float
Sets the projection’s clipping circle radius to the specified angle in degrees. If null, switches to [antimeridian](http://bl.ocks.org/mbostock/3788999) cutting rather than small-circle clipping.
- clipExtent : List(List(float))
Sets the projection’s viewport clip extent to the specified bounds in pixels. The extent bounds are specified as an array [[x0, y0], [x1, y1]], where x0 is the left-side of the viewport, y0 is the top, x1 is the right and y1 is the bottom. If null, no viewport clipping is performed.
- coefficient : float
- distance : float
- fraction : float
- lobes : float
- parallel : float
- precision : Mapping(required=[length])
Sets the threshold for the projection’s [adaptive resampling](http://bl.ocks.org/mbostock/3795544) to the specified value in pixels. This value corresponds to the [Douglas–Peucker distance](http://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm).
If precision is not specified, returns the projection’s current resampling
precision which defaults to √0.5 ≅ 0.70710….
- radius : float
- ratio : float
- rotate : List(float)
Sets the projection’s three-axis rotation to the specified angles, which must be a two- or three-element array of numbers [lambda, phi, gamma] specifying the rotation angles in degrees about each spherical axis. (These correspond to yaw, pitch and roll.)
Default value: [0, 0, 0]
- spacing : float
- tilt : float
-
properties
(**kwargs)¶ Set top-level properties of the Chart.
Argument names and types are the same as class initialization.
-
repeat
(row=Undefined, column=Undefined, **kwargs)¶ Return a RepeatChart built from the chart
Fields within the chart can be set to correspond to the row or column using alt.repeat(‘row’) and alt.repeat(‘column’).
Parameters: - row : list
a list of data column names to be mapped to the row facet
- column : list
a list of data column names to be mapped to the column facet
Returns: - chart : RepeatChart
a repeated chart.
-
resolve_axis
(x=Undefined, y=Undefined, **kwds)¶ AxisResolveMap schema wrapper
Mapping(required=[])
Attributes: - x : ResolveMode
- y : ResolveMode
-
resolve_legend
(color=Undefined, fill=Undefined, opacity=Undefined, shape=Undefined, size=Undefined, stroke=Undefined, **kwds)¶ LegendResolveMap schema wrapper
Mapping(required=[])
Attributes: - color : ResolveMode
- fill : ResolveMode
- opacity : ResolveMode
- shape : ResolveMode
- size : ResolveMode
- stroke : ResolveMode
-
resolve_scale
(color=Undefined, fill=Undefined, opacity=Undefined, shape=Undefined, size=Undefined, stroke=Undefined, x=Undefined, y=Undefined, **kwds)¶ ScaleResolveMap schema wrapper
Mapping(required=[])
Attributes: - color : ResolveMode
- fill : ResolveMode
- opacity : ResolveMode
- shape : ResolveMode
- size : ResolveMode
- stroke : ResolveMode
- x : ResolveMode
- y : ResolveMode
-
save
(fp, format=None, override_data_transformer=True, scale_factor=1.0, **kwargs)¶ Save a chart to file in a variety of formats
Supported formats are json, html, png, svg
Parameters: - fp : string filename or file-like object
file in which to write the chart.
- format : string (optional)
the format to write: one of [‘json’, ‘html’, ‘png’, ‘svg’]. If not specified, the format will be determined from the filename.
- override_data_transformer : boolean (optional)
If True (default), then the save action will be done with the default data_transformer with max_rows set to None. If False, then use the currently active data transformer.
- scale_factor : float
For svg or png formats, scale the image by this factor when saving. This can be used to control the size or resolution of the output. Default is 1.0
- **kwargs :
Additional keyword arguments are passed to the output method associated with the specified format.
-
savechart
(fp, format=None, **kwargs)¶ Save a chart to file in a variety of formats
Supported formats are json, html, png, svg
Parameters: - fp : string filename or file-like object
file in which to write the chart.
- format : string (optional)
the format to write: one of [‘json’, ‘html’, ‘png’, ‘svg’]. If not specified, the format will be determined from the filename.
- **kwargs :
Additional keyword arguments are passed to the output method associated with the specified format.
-
serve
(ip='127.0.0.1', port=8888, n_retries=50, files=None, jupyter_warning=True, open_browser=True, http_server=None, **kwargs)¶ Open a browser window and display a rendering of the chart
Parameters: - html : string
HTML to serve
- ip : string (default = ‘127.0.0.1’)
ip address at which the HTML will be served.
- port : int (default = 8888)
the port at which to serve the HTML
- n_retries : int (default = 50)
the number of nearby ports to search if the specified port is already in use.
- files : dictionary (optional)
dictionary of extra content to serve
- jupyter_warning : bool (optional)
if True (default), then print a warning if this is used within the Jupyter notebook
- open_browser : bool (optional)
if True (default), then open a web browser to the given HTML
- http_server : class (optional)
optionally specify an HTTPServer class to use for showing the figure. The default is Python’s basic HTTPServer.
- **kwargs :
additional keyword arguments passed to the save() method
-
to_dict
(*args, **kwargs)¶ Convert the chart to a dictionary suitable for JSON export
-
transform_aggregate
(aggregate=Undefined, groupby=Undefined, **kwds)¶ Add an AggregateTransform to the schema.
Parameters: - aggregate : List(AggregatedFieldDef)
Array of objects that define fields to aggregate.
- groupby : List(string)
The data fields to group by. If not specified, a single group containing all data objects will be used.
- **kwds :
additional keywords are converted to aggregates using standard shorthand parsing.
Returns: - self : Chart object
returns chart to allow for chaining
See also
alt.AggregateTransform
- underlying transform object
Examples
The aggregate transform allows you to specify transforms directly using the same shorthand syntax as used in encodings:
>>> import altair as alt >>> chart1 = alt.Chart().transform_aggregate( ... mean_acc='mean(Acceleration)', ... groupby=['Origin'] ... ) >>> print(chart1.transform[0].to_json()) { "aggregate": [ { "as": "mean_acc", "field": "Acceleration", "op": "mean" } ], "groupby": [ "Origin" ] }
It also supports including AggregatedFieldDef instances or dicts directly, so you can create the above transform like this:
>>> chart2 = alt.Chart().transform_aggregate( ... [alt.AggregatedFieldDef(field='Acceleration', op='mean', ... **{'as': 'mean_acc'})], ... groupby=['Origin'] ... ) >>> chart2.transform == chart1.transform True
-
transform_bin
(as_=Undefined, field=Undefined, bin=True, **kwargs)¶ Add a BinTransform to the schema.
Returns: - self : Chart object
returns chart to allow for chaining
See also
alt.BinTransform
- underlying transform object
Examples
>>> import altair as alt >>> chart = alt.Chart().transform_bin("x_binned", "x") >>> chart.transform[0] BinTransform({ as: 'x_binned', bin: True, field: 'x' })
>>> chart = alt.Chart().transform_bin("x_binned", "x", ... bin=alt.Bin(maxbins=10)) >>> chart.transform[0] BinTransform({ as: 'x_binned', bin: BinParams({ maxbins: 10 }), field: 'x' })
Attributes: - as_ : string
The output fields at which to write the start and end bin values.
- bin : anyOf(boolean, BinParams)
An object indicating bin properties, or simply true for using default bin parameters.
- field : string
The data field to bin.
-
transform_calculate
(as_=Undefined, calculate=Undefined, **kwargs)¶ Add a CalculateTransform to the schema.
Returns: - self : Chart object
returns chart to allow for chaining
See also
alt.CalculateTransform
- underlying transform object
Examples
>>> import altair as alt >>> from altair import datum, expr
>>> chart = alt.Chart().transform_calculate(y = 2 * expr.sin(datum.x)) >>> chart.transform[0] CalculateTransform({ as: 'y', calculate: (2 * sin(datum.x)) })
It’s also possible to pass the
CalculateTransform
arguments directly:>>> kwds = {'as': 'y', 'calculate': '2 * sin(datum.x)'} >>> chart = alt.Chart().transform_calculate(**kwds) >>> chart.transform[0] CalculateTransform({ as: 'y', calculate: '2 * sin(datum.x)' })
As the first form is easier to write and understand, that is the recommended method.
Attributes: - as_ : string
The output fields at which to write the start and end bin values.
- calculate : string or alt.expr expression
An expression string. Use the variable datum to refer to the current data object.
- **kwargs
transforms can also be passed by keyword argument; see Examples
-
transform_filter
(filter, **kwargs)¶ Add a FilterTransform to the schema.
Returns: - self : Chart object
returns chart to allow for chaining
See also
alt.FilterTransform
- underlying transform object
Attributes: - filter : a filter expression
The filter property must be one of the predicate definitions: (1) a string or alt.expr expression (2) a range predicate (3) a selection predicate (4) a logical operand combining (1)-(3) (5) a NamedSelection object
-
transform_lookup
(as_=Undefined, from_=Undefined, lookup=Undefined, default=Undefined, **kwargs)¶ Add a LookupTransform to the schema
Returns: - self : Chart object
returns chart to allow for chaining
See also
alt.LookupTransform
- underlying transform object
Attributes: - as_ : string or List(string)
The field or fields for storing the computed formula value. If from.fields is specified, the transform will use the same names for as. If from.fields is not specified, as has to be a string and we put the whole object into the data under the specified name.
- from_ : LookupData
Secondary data reference.
- lookup : string
Key in primary data source.
- default : string
The default value to use if lookup fails
-
transform_timeunit
(as_=Undefined, field=Undefined, timeUnit=Undefined, **kwargs)¶ Add a TimeUnitTransform to the schema.
Returns: - self : Chart object
returns chart to allow for chaining
See also
alt.TimeUnitTransform
- underlying transform object
Examples
>>> import altair as alt >>> from altair import datum, expr
>>> chart = alt.Chart().transform_timeunit(month='month(date)') >>> chart.transform[0] TimeUnitTransform({ as: 'month', field: 'date', timeUnit: 'month' })
It’s also possible to pass the
TimeUnitTransform
arguments directly; this is most useful in cases where the desired field name is not a valid python identifier:>>> kwds = {'as': 'month', 'timeUnit': 'month', 'field': 'The Month'} >>> chart = alt.Chart().transform_timeunit(**kwds) >>> chart.transform[0] TimeUnitTransform({ as: 'month', field: 'The Month', timeUnit: 'month' })
As the first form is easier to write and understand, that is the recommended method.
Attributes: - as_ : string
The output fields at which to write the start and end bin values.
- field : string
The data field to apply time unit.
- timeUnit : TimeUnit
The timeUnit.
- **kwargs
transforms can also be passed by keyword argument; see Examples
-
transform_window
(window=Undefined, frame=Undefined, groupby=Undefined, ignorePeers=Undefined, sort=Undefined, **kwargs)¶ Add a WindowTransform to the schema
Examples
A cumulative line chart
>>> import altair as alt >>> import numpy as np >>> import pandas as pd >>> data = pd.DataFrame({'x': np.arange(100), ... 'y': np.random.randn(100)}) >>> chart = alt.Chart(data).mark_line().encode( ... x='x:Q', ... y='ycuml:Q' ... ).transform_window( ... ycuml='sum(y)' ... ) >>> chart.transform[0] WindowTransform({ window: [WindowFieldDef({ as: 'ycuml', field: 'y', op: 'sum' })] })
Attributes: - window : List(WindowFieldDef)
The definition of the fields in the window, and what calculations to use.
- frame : List(anyOf(None, float))
A frame specification as a two-element array indicating how the sliding window should proceed. The array entries should either be a number indicating the offset from the current data object, or null to indicate unbounded rows preceding or following the current data object. The default value is
[null, 0]
, indicating that the sliding window includes the current object and all preceding objects. The value[-5, 5]
indicates that the window should include five objects preceding and five objects following the current object. Finally,[null, null]
indicates that the window frame should always include all data objects. The only operators affected are the aggregation operations and thefirst_value
,last_value
, andnth_value
window operations. The other window operations are not affected bythis.
Default value: :
[null, 0]
(includes the current object and all preceding objects)- groupby : List(string)
The data fields for partitioning the data objects into separate windows. If unspecified, all data points will be a single group.
- ignorePeers : boolean
Indicates if the sliding window frame should ignore peer values. (Peer values are those considered identical by the sort criteria). The default is false, causing the window frame to expand to include all peer values. If set to true, the window frame will be defined by offset values only. This setting only affects those operations that depend on the window frame, namely aggregation operations and the first_value, last_value, and nth_value window operations.
Default value:
false
- sort : List(SortField)
A sort field definition for sorting data objects within a window. If two data objects are considered equal by the comparator, they are considered “peer” values of
equal rank. If sort is not specified, the order is undefined: data objects are
processed in the order they are observed and none are considered peers (the ignorePeers parameter is ignored and treated as if set to
true
).- **kwargs
transforms can also be passed by keyword argument; see Examples
-
-
class
altair.
TopLevelRepeatSpec
(repeat=Undefined, spec=Undefined, align=Undefined, autosize=Undefined, background=Undefined, bounds=Undefined, center=Undefined, config=Undefined, data=Undefined, datasets=Undefined, description=Undefined, name=Undefined, padding=Undefined, resolve=Undefined, spacing=Undefined, title=Undefined, transform=Undefined, **kwds)¶ TopLevelRepeatSpec schema wrapper
Mapping(required=[repeat, spec])Attributes: - repeat : Repeat
An object that describes what fields should be repeated into views that are laid out as a
row
orcolumn
.spec : Spec
- align : anyOf(VgLayoutAlign, RowColVgLayoutAlign)
The alignment to apply to grid rows and columns. 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. Alternatively, an object value of the form{"row": string, "column": string}
canbe used to supply different alignments for rows and columns. Default value:
"all"
.- autosize : anyOf(AutosizeType, AutoSizeParams)
Sets how the visualization size should be determined. If a string, should be one of
"pad"
,"fit"
or"none"
. Object values can additionally specify parameters for content sizing and automatic resizing."fit"
is only supported for single and layered views that don’t userangeStep
.Default value :
pad
background : string
- <<<<<<< HEAD
CSS color property to use as the background of visualization.
Default value: none (transparent)
- =======
CSS color property to use as the background of visualization. Default value: none (transparent)
- bounds : enum(‘full’, ‘flush’)
The bounds calculation method to use for determining the extent of a sub-plot. One of
full
(the default) orflush
. * If set tofull
, the entire calculated bounds (including axes, title, and legend) will be used. * If set toflush
, only the specified width and height values for the sub-view will be used.The
flush
setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. Default value:"full"
- center : anyOf(boolean, RowColboolean)
Boolean flag indicating if subviews should be centered relative to their respective rows or columns. An object value of the form
{"row": boolean, "column": boolean}
can be used to supply different centering values for rows and columns. Default value:false
- >>>>>>> altair-viz/master
- config : Config
Vega-Lite configuration object. This property can only be defined at the top-level of a specification.
- data : Data
An object describing the data source
- datasets : Datasets
A global data store for named datasets. This is a mapping from names to inline datasets. This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a
data
property.- description : string
Description of this mark for commenting purpose.
- name : string
Name of the visualization for later reference.
- padding : Padding
The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format
{"left": 5, "top": 5, "right": 5, "bottom": 5}
to specify padding for each side of the visualization.Default value :
5
- resolve : Resolve
Scale and legend resolutions for repeated charts.
- spacing : anyOf(float, RowColnumber)
The spacing in pixels between sub-views of the composition operator. An object of the form
{"row": number, "column": number}
can be used to set different spacing values for rows and columns. Default value :10
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- $schema : string
URL to JSON schema for a Vega-Lite specification. Unless you have a reason to change this, use
https://vega.github.io/schema/vega-lite/v2.json
. Setting the$schema
property allows automatic validation and autocomplete in editors that support JSON schema.
-
class
altair.
TopLevelSpec
(*args, **kwds)¶ TopLevelSpec schema wrapper
anyOf(TopLevelFacetedUnitSpec, TopLevelFacetSpec, TopLevelLayerSpec, TopLevelRepeatSpec, TopLevelVConcatSpec, TopLevelHConcatSpec)
-
class
altair.
TopLevelVConcatSpec
(vconcat=Undefined, autosize=Undefined, background=Undefined, bounds=Undefined, center=Undefined, config=Undefined, data=Undefined, datasets=Undefined, description=Undefined, name=Undefined, padding=Undefined, resolve=Undefined, spacing=Undefined, title=Undefined, transform=Undefined, **kwds)¶ TopLevelVConcatSpec schema wrapper
Mapping(required=[vconcat])Attributes: - vconcat : List(Spec)
A list of views that should be concatenated and put into a column.
- autosize : anyOf(AutosizeType, AutoSizeParams)
Sets how the visualization size should be determined. If a string, should be one of
"pad"
,"fit"
or"none"
. Object values can additionally specify parameters for content sizing and automatic resizing."fit"
is only supported for single and layered views that don’t userangeStep
.Default value :
pad
background : string
- <<<<<<< HEAD
CSS color property to use as the background of visualization.
Default value: none (transparent)
- =======
CSS color property to use as the background of visualization. Default value: none (transparent)
- bounds : enum(‘full’, ‘flush’)
The bounds calculation method to use for determining the extent of a sub-plot. One of
full
(the default) orflush
. * If set tofull
, the entire calculated bounds (including axes, title, and legend) will be used. * If set toflush
, only the specified width and height values for the sub-view will be used.The
flush
setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. Default value:"full"
- center : boolean
Boolean flag indicating if subviews should be centered relative to their respective rows or columns. Default value:
false
- >>>>>>> altair-viz/master
- config : Config
Vega-Lite configuration object. This property can only be defined at the top-level of a specification.
- data : Data
An object describing the data source
- datasets : Datasets
A global data store for named datasets. This is a mapping from names to inline datasets. This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a
data
property.- description : string
Description of this mark for commenting purpose.
- name : string
Name of the visualization for later reference.
- padding : Padding
The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format
{"left": 5, "top": 5, "right": 5, "bottom": 5}
to specify padding for each side of the visualization.Default value :
5
- resolve : Resolve
Scale, axis, and legend resolutions for vertically concatenated charts.
- spacing : float
- The spacing in pixels between sub-views of the concat operator. Default value :
10
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- $schema : string
URL to JSON schema for a Vega-Lite specification. Unless you have a reason to change this, use
https://vega.github.io/schema/vega-lite/v2.json
. Setting the$schema
property allows automatic validation and autocomplete in editors that support JSON schema.
-
class
altair.
TopoDataFormat
(feature=Undefined, mesh=Undefined, parse=Undefined, type=Undefined, **kwds)¶ TopoDataFormat schema wrapper
Mapping(required=[])
Attributes: - feature : string
The name of the TopoJSON object set to convert to a GeoJSON feature collection. For example, in a map of the world, there may be an object set named
"countries"
. Using the feature property, we can extract this set and generate a GeoJSON feature object for each country.- mesh : string
The name of the TopoJSON object set to convert to mesh. Similar to the
feature
option,mesh
extracts a named TopoJSON object set. Unlike thefeature
option, the corresponding geo data is returned as a single, unified mesh instance, not as individual GeoJSON features. Extracting a mesh is useful for more efficiently drawing borders or other geographic elements that you do not need to associate with specific regions such as individual countries, states or counties.- parse : anyOf(enum(‘auto’), Parse, None)
If set to
"auto"
(the default), perform automatic type inference to determine the desired data types. If set tonull
, disable type inference based on the spec and only use type inference based on the data. Alternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of"number"
,"boolean"
,"date"
, or null (do not parse the field)). For example,"parse": {"modified_on": "date"}
parses themodified_on
field in each input record a Date value.For
"date"
, we parse data based using Javascript’s Date.parse(). For Specific date formats can be provided (e.g.,{foo: 'date:"%m%d%Y"'}
), using the d3-time-format syntax. UTC date format parsing is supported similarly (e.g.,{foo: 'utc:"%m%d%Y"'}
). See more about UTC time- type : enum(‘topojson’)
Type of input data:
"json"
,"csv"
,"tsv"
,"dsv"
. The default format type is determined by the extension of the file URL. If no extension is detected,"json"
will be used by default.
-
class
altair.
Transform
(*args, **kwds)¶ Transform schema wrapper
anyOf(FilterTransform, CalculateTransform, LookupTransform, BinTransform, TimeUnitTransform, AggregateTransform, WindowTransform)
-
class
altair.
Type
(*args, **kwds)¶ Type schema wrapper
anyOf(BasicType, GeoType) Constants and utilities for data type
Data type based on level of measurement
-
class
altair.
UrlData
(url=Undefined, format=Undefined, name=Undefined, **kwds)¶ UrlData schema wrapper
Mapping(required=[url])
Attributes: - url : string
An URL from which to load the data set. Use the
format.type
property to ensure the loaded data is correctly parsed.- format : DataFormat
An object that specifies the format for parsing the data.
- name : string
Provide a placeholder name and bind data at runtime.
-
class
altair.
UtcMultiTimeUnit
(*args)¶ UtcMultiTimeUnit schema wrapper
enum(‘utcyearquarter’, ‘utcyearquartermonth’, ‘utcyearmonth’, ‘utcyearmonthdate’, ‘utcyearmonthdatehours’, ‘utcyearmonthdatehoursminutes’, ‘utcyearmonthdatehoursminutesseconds’, ‘utcquartermonth’, ‘utcmonthdate’, ‘utchoursminutes’, ‘utchoursminutesseconds’, ‘utcminutesseconds’, ‘utcsecondsmilliseconds’)
-
class
altair.
UtcSingleTimeUnit
(*args)¶ UtcSingleTimeUnit schema wrapper
enum(‘utcyear’, ‘utcquarter’, ‘utcmonth’, ‘utcday’, ‘utcdate’, ‘utchours’, ‘utcminutes’, ‘utcseconds’, ‘utcmilliseconds’)
-
class
altair.
VConcatChart
(data=Undefined, vconcat=(), **kwargs) - A chart with vertically-concatenated facets
- Mapping(required=[vconcat])
Attributes: - vconcat : List(Spec)
A list of views that should be concatenated and put into a column.
- autosize : anyOf(AutosizeType, AutoSizeParams)
Sets how the visualization size should be determined. If a string, should be one of
"pad"
,"fit"
or"none"
. Object values can additionally specify parameters for content sizing and automatic resizing."fit"
is only supported for single and layered views that don’t userangeStep
.Default value :
pad
background : string
- <<<<<<< HEAD
CSS color property to use as the background of visualization.
Default value: none (transparent)
- =======
CSS color property to use as the background of visualization. Default value: none (transparent)
- bounds : enum(‘full’, ‘flush’)
The bounds calculation method to use for determining the extent of a sub-plot. One of
full
(the default) orflush
. * If set tofull
, the entire calculated bounds (including axes, title, and legend) will be used. * If set toflush
, only the specified width and height values for the sub-view will be used.The
flush
setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. Default value:"full"
- center : boolean
Boolean flag indicating if subviews should be centered relative to their respective rows or columns. Default value:
false
- >>>>>>> altair-viz/master
- config : Config
Vega-Lite configuration object. This property can only be defined at the top-level of a specification.
- data : Data
An object describing the data source
- datasets : Datasets
A global data store for named datasets. This is a mapping from names to inline datasets. This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a
data
property.- description : string
Description of this mark for commenting purpose.
- name : string
Name of the visualization for later reference.
- padding : Padding
The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format
{"left": 5, "top": 5, "right": 5, "bottom": 5}
to specify padding for each side of the visualization.Default value :
5
- resolve : Resolve
Scale, axis, and legend resolutions for vertically concatenated charts.
- spacing : float
- The spacing in pixels between sub-views of the concat operator. Default value :
10
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
- $schema : string
URL to JSON schema for a Vega-Lite specification. Unless you have a reason to change this, use
https://vega.github.io/schema/vega-lite/v2.json
. Setting the$schema
property allows automatic validation and autocomplete in editors that support JSON schema.
-
class
altair.
VConcatSpec
(vconcat=Undefined, bounds=Undefined, center=Undefined, data=Undefined, description=Undefined, name=Undefined, resolve=Undefined, spacing=Undefined, title=Undefined, transform=Undefined, **kwds)¶ VConcatSpec schema wrapper
Mapping(required=[vconcat])
Attributes: - vconcat : List(Spec)
A list of views that should be concatenated and put into a column.
- bounds : enum(‘full’, ‘flush’)
The bounds calculation method to use for determining the extent of a sub-plot. One of
full
(the default) orflush
. * If set tofull
, the entire calculated bounds (including axes, title, and legend) will be used. * If set toflush
, only the specified width and height values for the sub-view will be used.The
flush
setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. Default value:"full"
- center : boolean
Boolean flag indicating if subviews should be centered relative to their respective rows or columns. Default value:
false
- data : Data
An object describing the data source
- description : string
Description of this mark for commenting purpose.
- name : string
Name of the visualization for later reference.
- resolve : Resolve
Scale, axis, and legend resolutions for vertically concatenated charts.
- spacing : float
- The spacing in pixels between sub-views of the concat operator. Default value :
10
- title : anyOf(string, TitleParams)
Title for the plot.
- transform : List(Transform)
An array of data transformations such as filter and new field calculation.
-
class
altair.
ValueDef
(value=Undefined, **kwds)¶ ValueDef schema wrapper
Mapping(required=[value]) Definition object for a constant value of an encoding channel.
Attributes: - value : anyOf(float, string, boolean)
A constant value in visual domain (e.g.,
"red"
/ “#0099ff” for color, values between0
to1
for opacity).
-
class
altair.
ValueDefWithCondition
(condition=Undefined, value=Undefined, **kwds)¶ ValueDefWithCondition schema wrapper
Mapping(required=[]) A ValueDef with Condition<ValueDef | FieldDef>
Attributes: - condition : anyOf(ConditionalFieldDef, ConditionalValueDef, List(ConditionalValueDef))
A field definition or one or more value definition(s) with a selection predicate.
- value : anyOf(float, string, boolean)
A constant value in visual domain.
-
class
altair.
VegaLite
(spec, validate=False)¶ An IPython/Jupyter display class for rendering VegaLite 2.
-
class
altair.
VegaLiteSchema
(*args, **kwds)¶
-
class
altair.
VerticalAlign
(*args)¶ VerticalAlign schema wrapper
enum(‘top’, ‘middle’, ‘bottom’)
-
class
altair.
VgAxisConfig
(bandPosition=Undefined, domain=Undefined, domainColor=Undefined, domainWidth=Undefined, grid=Undefined, gridColor=Undefined, gridDash=Undefined, gridOpacity=Undefined, gridWidth=Undefined, labelAngle=Undefined, labelBound=Undefined, labelColor=Undefined, labelFlush=Undefined, labelFont=Undefined, labelFontSize=Undefined, labelLimit=Undefined, labelOverlap=Undefined, labelPadding=Undefined, labels=Undefined, maxExtent=Undefined, minExtent=Undefined, tickColor=Undefined, tickRound=Undefined, tickSize=Undefined, tickWidth=Undefined, ticks=Undefined, titleAlign=Undefined, titleAngle=Undefined, titleBaseline=Undefined, titleColor=Undefined, titleFont=Undefined, titleFontSize=Undefined, titleFontWeight=Undefined, titleLimit=Undefined, titleMaxLength=Undefined, titlePadding=Undefined, titleX=Undefined, titleY=Undefined, **kwds)¶ VgAxisConfig schema wrapper
Mapping(required=[])
Attributes: - bandPosition : float
An interpolation fraction indicating where, for
band
scales, axis ticks should be positioned. A value of0
places ticks at the left edge of their bands. A value of0.5
places ticks in the middle of their bands.- domain : boolean
A boolean flag indicating if the domain (the axis baseline) should be included as part of the axis.
Default value:
true
- domainColor : string
Color of axis domain line.
Default value: (none, using Vega default).
- domainWidth : float
Stroke width of axis domain line
Default value: (none, using Vega default).
- grid : boolean
A boolean flag indicating if grid lines should be included as part of the axis
Default value:
true
for continuous scales that are not binned; otherwise,false
.- gridColor : string
Color of gridlines.
- gridDash : List(float)
The offset (in pixels) into which to begin drawing with the grid dash array.
- gridOpacity : float
The stroke opacity of grid (value between [0,1])
Default value: (
1
by default)- gridWidth : float
The grid width, in pixels.
- labelAngle : float
The rotation angle of the axis labels.
Default value:
-90
for nominal and ordinal fields;0
otherwise.- labelBound : anyOf(boolean, float)
Indicates if labels should be hidden if they exceed the axis range. If
false
(the default) no bounds overlap analysis is performed. Iftrue
, labels will be hidden if they exceed the axis range by more than 1 pixel. If this property is a number, it specifies the pixel tolerance: the maximum amount by which a label bounding box may exceed the axis range.Default value:
false
.- labelColor : string
The color of the tick label, can be in hex color code or regular color name.
- labelFlush : anyOf(boolean, float)
Indicates if the first and last axis labels should be aligned flush with the scale range. Flush alignment for a horizontal axis will left-align the first label and right-align the last label. For vertical axes, bottom and top text baselines are applied instead. If this property is a number, it also indicates the number of pixels by which to offset the first and last labels; for example, a value of 2 will flush-align the first and last labels and also push them 2 pixels outward from the center of the axis. The additional adjustment can sometimes help the labels better visually group with corresponding axis ticks.
Default value:
true
for axis of a continuous x-scale. Otherwise,false
.- labelFont : string
The font of the tick label.
- labelFontSize : float
The font size of the label, in pixels.
- labelLimit : float
Maximum allowed pixel width of axis tick labels.
- labelOverlap : anyOf(boolean, enum(‘parity’), enum(‘greedy’))
The strategy to use for resolving overlap of axis labels. If
false
(the default), no overlap reduction is attempted. If set totrue
or"parity"
, a strategy of removing every other label is used (this works well for standard linear axes). If set to"greedy"
, a linear scan of the labels is performed, removing any labels that overlaps with the last visible label (this often works better for log-scaled axes).Default value:
true
for non-nominal fields with non-log scales;"greedy"
for log scales; otherwisefalse
.- labelPadding : float
The padding, in pixels, between axis and text labels.
- labels : boolean
A boolean flag indicating if labels should be included as part of the axis.
Default value:
true
.- maxExtent : float
The maximum extent in pixels that axis ticks and labels should use. This determines a maximum offset value for axis titles.
Default value:
undefined
.- minExtent : float
The minimum extent in pixels that axis ticks and labels should use. This determines a minimum offset value for axis titles.
Default value:
30
for y-axis;undefined
for x-axis.- tickColor : string
The color of the axis’s tick.
- tickRound : boolean
Boolean flag indicating if pixel position values should be rounded to the nearest integer.
- tickSize : float
The size in pixels of axis ticks.
- tickWidth : float
The width, in pixels, of ticks.
- ticks : boolean
Boolean value that determines whether the axis should include ticks.
- titleAlign : string
Horizontal text alignment of axis titles.
- titleAngle : float
Angle in degrees of axis titles.
- titleBaseline : string
Vertical text baseline for axis titles.
- titleColor : string
Color of the title, can be in hex color code or regular color name.
- titleFont : string
Font of the title. (e.g.,
"Helvetica Neue"
).- titleFontSize : float
Font size of the title.
- titleFontWeight : FontWeight
Font weight of the title. This can be either a string (e.g
"bold"
,"normal"
) or a number (100
,200
,300
, …,900
where"normal"
=400
and"bold"
=700
).- titleLimit : float
Maximum allowed pixel width of axis titles.
- titleMaxLength : float
Max length for axis title if the title is automatically generated from the field’s description.
- titlePadding : float
The padding, in pixels, between title and axis.
- titleX : float
X-coordinate of the axis title relative to the axis group.
- titleY : float
Y-coordinate of the axis title relative to the axis group.
-
class
altair.
VgBinding
(*args, **kwds)¶ VgBinding schema wrapper
anyOf(VgCheckboxBinding, VgRadioBinding, VgSelectBinding, VgRangeBinding, VgGenericBinding)
-
class
altair.
VgCheckboxBinding
(input=Undefined, element=Undefined, **kwds)¶ VgCheckboxBinding schema wrapper
Mapping(required=[input])
Attributes: - input : enum(‘checkbox’)
- element : string
-
class
altair.
VgComparatorOrder
(*args)¶ VgComparatorOrder schema wrapper
enum(‘ascending’, ‘descending’)
-
class
altair.
VgEventStream
(**kwds)¶ VgEventStream schema wrapper
Mapping(required=[])
-
class
altair.
VgGenericBinding
(input=Undefined, element=Undefined, **kwds)¶ VgGenericBinding schema wrapper
Mapping(required=[input])
Attributes: - input : string
- element : string
-
class
altair.
VgLayoutAlign
(*args)¶ VgLayoutAlign schema wrapper
enum(‘none’, ‘each’, ‘all’)
-
class
altair.
VgMarkConfig
(align=Undefined, angle=Undefined, baseline=Undefined, cornerRadius=Undefined, cursor=Undefined, dir=Undefined, dx=Undefined, dy=Undefined, ellipsis=Undefined, fill=Undefined, fillOpacity=Undefined, font=Undefined, fontSize=Undefined, fontStyle=Undefined, fontWeight=Undefined, href=Undefined, interpolate=Undefined, limit=Undefined, opacity=Undefined, orient=Undefined, radius=Undefined, shape=Undefined, size=Undefined, stroke=Undefined, strokeCap=Undefined, strokeDash=Undefined, strokeDashOffset=Undefined, strokeJoin=Undefined, strokeMiterLimit=Undefined, strokeOpacity=Undefined, strokeWidth=Undefined, tension=Undefined, text=Undefined, theta=Undefined, tooltip=Undefined, **kwds)¶ VgMarkConfig schema wrapper
Mapping(required=[])Attributes: - align : HorizontalAlign
The horizontal alignment of the text. One of
"left"
,"right"
,"center"
.- angle : float
The rotation angle of the text, in degrees.
- baseline : VerticalAlign
The vertical alignment of the text. One of
"top"
,"middle"
,"bottom"
.Default value:
"middle"
- cornerRadius : float
The radius in pixels of rounded rectangle corners. Default value:
0
- cursor : Cursor
The mouse cursor used over the mark. Any valid CSS cursor type can be used.
- dir : Dir
The direction of the text. One of
"ltr"
(left-to-right) or"rtl"
(right-to-left). This property determines on which side is truncated in response to the limit parameter. Default value:"ltr"
- dx : float
The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- dy : float
The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the angle property.
- ellipsis : string
The ellipsis string for text truncated in response to the limit parameter. Default value:
"…"
- fill : string
Default Fill Color. This has higher precedence than
config.color
Default value: (None)
- fillOpacity : float
The fill opacity (value between [0,1]).
Default value:
1
- font : string
The typeface to set the text in (e.g.,
"Helvetica Neue"
).- fontSize : float
The font size, in pixels.
- fontStyle : FontStyle
The font style (e.g.,
"italic"
).- fontWeight : FontWeight
The font weight. This can be either a string (e.g
"bold"
,"normal"
) or a number (100
,200
,300
, …,900
where"normal"
=400
and"bold"
=700
).- href : string
A URL to load upon mouse click. If defined, the mark acts as a hyperlink.
- interpolate : Interpolate
The line interpolation method to use for line and area marks. One of the following:
"linear"
: piecewise linear segments, as in a polyline."linear-closed"
: close the linear segments to form a polygon."step"
: alternate between horizontal and vertical segments, as in a step function."step-before"
: alternate between vertical and horizontal segments, as in a step function."step-after"
: alternate between horizontal and vertical segments, as in a step function."basis"
: a B-spline, with control point duplication on the ends."basis-open"
: an open B-spline; may not intersect the start or end."basis-closed"
: a closed B-spline, as in a loop."cardinal"
: a Cardinal spline, with control point duplication on the ends."cardinal-open"
: an open Cardinal spline; may not intersect the start or end, but will intersect other control points."cardinal-closed"
: a closed Cardinal spline, as in a loop."bundle"
: equivalent to basis, except the tension parameter is used to straighten the spline."monotone"
: cubic interpolation that preserves monotonicity in y.
- limit : float
The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. Default value:
0
, indicating no limit- opacity : float
The overall opacity (value between [0,1]).
Default value:
0.7
for non-aggregate plots withpoint
,tick
,circle
, orsquare
marks or layeredbar
charts and1
otherwise.- orient : Orient
The orientation of a non-stacked bar, tick, area, and line charts. The value is either horizontal (default) or vertical.
- For bar, rule and tick, this determines whether the size of the bar and tick
should be applied to x or y dimension. * For area, this property determines the orient property of the Vega output. * For line and trail marks, this property determines the sort order of the points in
the line
if
config.sortLineBy
is not specified. For stacked charts, this is always determined by the orientation of the stack; therefore explicitly specified value will be ignored.- radius : float
Polar coordinate radial offset, in pixels, of the text label from the origin determined by the
x
andy
properties.- shape : string
The default symbol shape to use. One of:
"circle"
(default),"square"
,"cross"
,"diamond"
,"triangle-up"
, or"triangle-down"
, or a custom SVG path.Default value:
"circle"
- size : float
The pixel area each the point/circle/square. For example: in the case of circles, the radius is determined in part by the square root of the size value.
Default value:
30
stroke : string
- <<<<<<< HEAD
Default Stroke Color. This has higher precedence than
config.color
Default value: (None)
strokeCap : enum(‘butt’, ‘round’, ‘square’)
- =======
Default Stroke Color. This has higher precedence than
config.color
Default value: (None)strokeCap : StrokeCap
- >>>>>>> altair-viz/master
The stroke cap for line ending style. One of
"butt"
,"round"
, or"square"
.Default value:
"square"
- strokeDash : List(float)
An array of alternating stroke, space lengths for creating dashed or dotted lines.
- strokeDashOffset : float
The offset (in pixels) into which to begin drawing with the stroke dash array.
- strokeJoin : StrokeJoin
The stroke line join method. One of
"miter"
,"round"
or"bevel"
. Default value:"miter"
- strokeMiterLimit : float
The miter limit at which to bevel a line join.
- strokeOpacity : float
The stroke opacity (value between [0,1]).
Default value:
1
- strokeWidth : float
The stroke width, in pixels.
- tension : float
Depending on the interpolation type, sets the tension parameter (for line and area marks).
- text : string
Placeholder text if the
text
channel is not specified- theta : float
Polar coordinate angle, in radians, of the text label from the origin determined by the
x
andy
properties. Values fortheta
follow the same convention ofarc
markstartAngle
andendAngle
properties: angles are measured in radians, with0
indicating “north”.- tooltip : Mapping(required=[])
The tooltip text to show upon mouse hover.
-
class
altair.
VgProjectionType
(*args)¶ VgProjectionType schema wrapper
enum(‘albers’, ‘albersUsa’, ‘azimuthalEqualArea’, ‘azimuthalEquidistant’, ‘conicConformal’, ‘conicEqualArea’, ‘conicEquidistant’, ‘equirectangular’, ‘gnomonic’, ‘mercator’, ‘orthographic’, ‘stereographic’, ‘transverseMercator’)
-
class
altair.
VgRadioBinding
(input=Undefined, options=Undefined, element=Undefined, **kwds)¶ VgRadioBinding schema wrapper
Mapping(required=[input, options])
Attributes: - input : enum(‘radio’)
- options : List(string)
- element : string
-
class
altair.
VgRangeBinding
(input=Undefined, element=Undefined, max=Undefined, min=Undefined, step=Undefined, **kwds)¶ VgRangeBinding schema wrapper
Mapping(required=[input])
Attributes: - input : enum(‘range’)
- element : string
- max : float
- min : float
- step : float
-
class
altair.
VgScheme
(scheme=Undefined, count=Undefined, extent=Undefined, **kwds)¶ VgScheme schema wrapper
Mapping(required=[scheme])
Attributes: - scheme : string
- count : float
- extent : List(float)
-
class
altair.
VgSelectBinding
(input=Undefined, options=Undefined, element=Undefined, **kwds)¶ VgSelectBinding schema wrapper
Mapping(required=[input, options])
Attributes: - input : enum(‘select’)
- options : List(string)
- element : string
-
class
altair.
VgTitleConfig
(anchor=Undefined, angle=Undefined, baseline=Undefined, color=Undefined, font=Undefined, fontSize=Undefined, fontWeight=Undefined, limit=Undefined, offset=Undefined, orient=Undefined, **kwds)¶ VgTitleConfig schema wrapper
Mapping(required=[])
Attributes: - anchor : Anchor
The anchor position for placing the title. One of
"start"
,"middle"
, or"end"
. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title.Default value:
"middle"
for single and layered views."start"
for other composite views.Note: For now,
anchor
is only customizable only for single and layered views. For other composite views,anchor
is always"start"
.- angle : float
Angle in degrees of title text.
- baseline : VerticalAlign
Vertical text baseline for title text.
- color : string
Text color for title text.
- font : string
Font name for title text.
- fontSize : float
Font size in pixels for title text.
Default value:
10
.- fontWeight : FontWeight
Font weight for title text. This can be either a string (e.g
"bold"
,"normal"
) or a number (100
,200
,300
, …,900
where"normal"
=400
and"bold"
=700
).- limit : float
The maximum allowed length in pixels of legend labels.
- offset : float
Offset in pixels of the title from the chart body and axes.
- orient : TitleOrient
Default title orientation (“top”, “bottom”, “left”, or “right”)
-
class
altair.
ViewConfig
(clip=Undefined, fill=Undefined, fillOpacity=Undefined, height=Undefined, stroke=Undefined, strokeDash=Undefined, strokeDashOffset=Undefined, strokeJoin=Undefined, strokeMiterLimit=Undefined, strokeOpacity=Undefined, strokeWidth=Undefined, width=Undefined, **kwds)¶ ViewConfig schema wrapper
Mapping(required=[])
Attributes: - clip : boolean
Whether the view should be clipped.
- fill : string
The fill color.
Default value: (none)
- fillOpacity : float
The fill opacity (value between [0,1]).
Default value: (none)
- height : float
The default height of the single plot or each plot in a trellis plot when the visualization has a continuous (non-ordinal) y-scale with
rangeStep
=null
.Default value:
200
- stroke : string
The stroke color.
Default value: (none)
- strokeDash : List(float)
An array of alternating stroke, space lengths for creating dashed or dotted lines.
Default value: (none)
- strokeDashOffset : float
The offset (in pixels) into which to begin drawing with the stroke dash array.
Default value: (none)
- strokeJoin : StrokeJoin
The stroke line join method. One of miter (default), round or bevel. Default value: ‘miter’
- strokeMiterLimit : float
The stroke line join method. One of miter (default), round or bevel. Default value: ‘miter’
- strokeOpacity : float
The stroke opacity (value between [0,1]).
Default value: (none)
- strokeWidth : float
The stroke width, in pixels.
Default value: (none)
- width : float
The default width of the single plot or each plot in a trellis plot when the visualization has a continuous (non-ordinal) x-scale or ordinal x-scale with
rangeStep
=null
.Default value:
200
-
class
altair.
WindowFieldDef
(op=Undefined, field=Undefined, param=Undefined, **kwds)¶ WindowFieldDef schema wrapper
Mapping(required=[op, as])
Attributes: - op : anyOf(AggregateOp, WindowOnlyOp)
The window or aggregation operations to apply within a window, including
rank
,lead
,sum
,average
orcount
. See the list of all supported operations here.- field : string
The data field for which to compute the aggregate or window function. This can be omitted for window functions that do not operate over a field such as
count
,rank
,dense_rank
.- param : float
Parameter values for the window functions. Parameter values can be omitted for operations that do not accept a parameter.
See the list of all supported operations and their parameters here.
- as : string
The output name for the window operation.
-
class
altair.
WindowOnlyOp
(*args)¶ WindowOnlyOp schema wrapper
enum(‘row_number’, ‘rank’, ‘dense_rank’, ‘percent_rank’, ‘cume_dist’, ‘ntile’, ‘lag’, ‘lead’, ‘first_value’, ‘last_value’, ‘nth_value’)
-
class
altair.
WindowTransform
(window=Undefined, frame=Undefined, groupby=Undefined, ignorePeers=Undefined, sort=Undefined, **kwds)¶ WindowTransform schema wrapper
Mapping(required=[window])
Attributes: - window : List(WindowFieldDef)
The definition of the fields in the window, and what calculations to use.
- frame : List(anyOf(None, float))
A frame specification as a two-element array indicating how the sliding window should proceed. The array entries should either be a number indicating the offset from the current data object, or null to indicate unbounded rows preceding or following the current data object. The default value is
[null, 0]
, indicating that the sliding window includes the current object and all preceding objects. The value[-5, 5]
indicates that the window should include five objects preceding and five objects following the current object. Finally,[null, null]
indicates that the window frame should always include all data objects. The only operators affected are the aggregation operations and thefirst_value
,last_value
, andnth_value
window operations. The other window operations are not affected by this.Default value: :
[null, 0]
(includes the current object and all preceding objects)- groupby : List(string)
The data fields for partitioning the data objects into separate windows. If unspecified, all data points will be in a single group.
- ignorePeers : boolean
Indicates if the sliding window frame should ignore peer values. (Peer values are those considered identical by the sort criteria). The default is false, causing the window frame to expand to include all peer values. If set to true, the window frame will be defined by offset values only. This setting only affects those operations that depend on the window frame, namely aggregation operations and the first_value, last_value, and nth_value window operations.
Default value:
false
- sort : List(SortField)
A sort field definition for sorting data objects within a window. If two data objects are considered equal by the comparator, they are considered “peer” values of equal rank. If sort is not specified, the order is undefined: data objects are processed in the order they are observed and none are considered peers (the ignorePeers parameter is ignored and treated as if set to
true
).
-
class
altair.
X
(shorthand=Undefined, aggregate=Undefined, axis=Undefined, bin=Undefined, field=Undefined, scale=Undefined, sort=Undefined, stack=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds) X schema wrapper
Mapping(required=[shorthand])
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- axis : anyOf(Axis, None)
An object defining properties of axis’s gridlines, ticks and labels. If
null
, the axis for the encoding channel will be removed.Default value: If undefined, default axis properties are applied.
- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- stack : anyOf(StackOffset, None)
Type of stacking offset if the field should be stacked.
stack
is only applicable forx
andy
channels with continuous domains. For example,stack
ofy
can be used to customize stacking for a vertical bar chart.stack
can be one of the following values:- “zero”: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and area chart).
"normalize"
- stacking with normalized domain (for creating normalized stacked bar and area charts.
"center"
- stacking with center baseline (for `streamgraph
<https://vega.github.io/vega-lite/docs/stack.html#streamgraph>`_ ). *
null
- No-stacking. This will produce layered `bar<https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart>`_ and area chart.
Default value:
zero
for plots with all of the following conditions are true: (1) the mark isbar
orarea
; (2) the stacked measure channel (x or y) has a linear scale; (3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise,null
by default.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
X2
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds) X2 schema wrapper
Mapping(required=[shorthand]) Definition object for a data field, its type and transformation of an encoding channel.
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
X2Value
(value, **kwds) X2Value schema wrapper
Mapping(required=[value]) Definition object for a constant value of an encoding channel.
Attributes: - value : anyOf(float, string, boolean)
A constant value in visual domain (e.g.,
"red"
/ “#0099ff” for color, values between0
to1
for opacity).
-
class
altair.
XValue
(value, **kwds) XValue schema wrapper
Mapping(required=[value]) Definition object for a constant value of an encoding channel.
Attributes: - value : anyOf(float, string, boolean)
A constant value in visual domain (e.g.,
"red"
/ “#0099ff” for color, values between0
to1
for opacity).
-
class
altair.
Y
(shorthand=Undefined, aggregate=Undefined, axis=Undefined, bin=Undefined, field=Undefined, scale=Undefined, sort=Undefined, stack=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds) Y schema wrapper
Mapping(required=[shorthand])
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- axis : anyOf(Axis, None)
An object defining properties of axis’s gridlines, ticks and labels. If
null
, the axis for the encoding channel will be removed.Default value: If undefined, default axis properties are applied.
- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- scale : anyOf(Scale, None)
An object defining properties of the channel’s scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.
If
null
, the scale will be disabled and the data value will be directly encoded.Default value: If undefined, default scale properties are applied.
- sort : 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 sort field definition for sorting by another field.
- An array specifying the field values in preferred order. In this case, the
sort order will obey the values in the array, followed by any unspecified values
in their original order. For discrete time field, values in the sort array can be
date-time definition objects. In addition, for time units
"month"
and"day"
, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g.,"Mon"
,"Tue"
). null
indicating no sort.
Default value:
"ascending"
Note:
null
is not supported forrow
andcolumn
.- stack : anyOf(StackOffset, None)
Type of stacking offset if the field should be stacked.
stack
is only applicable forx
andy
channels with continuous domains. For example,stack
ofy
can be used to customize stacking for a vertical bar chart.stack
can be one of the following values:- “zero”: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and area chart).
"normalize"
- stacking with normalized domain (for creating normalized stacked bar and area charts.
"center"
- stacking with center baseline (for `streamgraph
<https://vega.github.io/vega-lite/docs/stack.html#streamgraph>`_ ). *
null
- No-stacking. This will produce layered `bar<https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart>`_ and area chart.
Default value:
zero
for plots with all of the following conditions are true: (1) the mark isbar
orarea
; (2) the stacked measure channel (x or y) has a linear scale; (3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise,null
by default.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
Y2
(shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds) Y2 schema wrapper
Mapping(required=[shorthand]) Definition object for a data field, its type and transformation of an encoding channel.
Attributes: - shorthand : string
shorthand for field, aggregate, and type
- aggregate : Aggregate
Aggregation function for the field (e.g.,
mean
,sum
,median
,min
,max
,count
).Default value:
undefined
(None)- bin : anyOf(boolean, BinParams)
A flag for binning a
quantitative
field, or an object defining binning parameters. Iftrue
, default binning parameters will be applied.Default value:
false
- field : anyOf(string, RepeatRef)
Required. 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.
Note: Dots (
.
) and brackets ([
and]
) can be used to access nested objects (e.g.,"field": "foo.bar"
and"field": "foo['bar']"
). If field names contain dots or brackets but are not nested, you can use\
to escape dots and brackets (e.g.,"a\.b"
and"a\[0\]"
). See more details about escaping in the field documentation.Note:
field
is not required ifaggregate
iscount
.- timeUnit : TimeUnit
Time unit (e.g.,
year
,yearmonth
,month
,hours
) for a temporal field. or a temporal field that gets casted as ordinal.Default value:
undefined
(None)- title : anyOf(string, None)
A title for the field. If
null
, the title will be removed.Default value: derived from the field’s name and transformation function (
aggregate
,bin
andtimeUnit
). If the field has an aggregate function, the function is displayed as part of the title (e.g.,"Sum of Profit"
). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g.,"Profit (binned)"
,"Transaction Date (year-month)"
). Otherwise, the title is simply the field name.Notes :
1) You can customize the default field title format by providing the [fieldTitle property in the config or fieldTitle function via the compile function’s options.
2) If both field definition’s
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.- type : Type
The encoded field’s type of measurement (
"quantitative"
,"temporal"
,"ordinal"
, or"nominal"
). It can also be a"geojson"
type for encoding ‘geoshape’.
-
class
altair.
Y2Value
(value, **kwds) Y2Value schema wrapper
Mapping(required=[value]) Definition object for a constant value of an encoding channel.
Attributes: - value : anyOf(float, string, boolean)
A constant value in visual domain (e.g.,
"red"
/ “#0099ff” for color, values between0
to1
for opacity).
-
class
altair.
YValue
(value, **kwds) YValue schema wrapper
Mapping(required=[value]) Definition object for a constant value of an encoding channel.
Attributes: - value : anyOf(float, string, boolean)
A constant value in visual domain (e.g.,
"red"
/ “#0099ff” for color, values between0
to1
for opacity).
-
class
altair.
curry
(*args, **kwargs)¶ Curry a callable function
Enables partial application of arguments through calling a function with an incomplete set of arguments.
>>> def mul(x, y): ... return x * y >>> mul = curry(mul)
>>> double = mul(2) >>> double(10) 20
Also supports keyword arguments
>>> @curry # Can use curry as a decorator ... def f(x, y, a=10): ... return a * (x + y)
>>> add = f(a=1) >>> add(2, 3) 5
- See Also:
- toolz.curried - namespace of curried functions
- https://toolz.readthedocs.io/en/latest/curry.html
-
altair.
binding
(self, *args, **kwds)¶ A generic binding anyOf(VgCheckboxBinding, VgRadioBinding, VgSelectBinding, VgRangeBinding, VgGenericBinding)
-
altair.
binding_checkbox
(self, input=Undefined, element=Undefined, **kwds)¶ A checkbox binding Mapping(required=[input])
Attributes: - input : enum(‘checkbox’)
- element : string
-
altair.
binding_radio
(self, input=Undefined, options=Undefined, element=Undefined, **kwds)¶ A radio button binding Mapping(required=[input, options])
Attributes: - input : enum(‘radio’)
- options : List(string)
- element : string
-
altair.
binding_range
(self, input=Undefined, element=Undefined, max=Undefined, min=Undefined, step=Undefined, **kwds)¶ A range binding Mapping(required=[input])
Attributes: - input : enum(‘range’)
- element : string
- max : float
- min : float
- step : float
-
altair.
binding_select
(self, input=Undefined, options=Undefined, element=Undefined, **kwds)¶ A select binding Mapping(required=[input, options])
Attributes: - input : enum(‘select’)
- options : List(string)
- element : string
-
altair.
condition
(predicate, if_true, if_false, **kwargs)¶ A conditional attribute or encoding
Parameters: - predicate: NamedSelection, LogicalOperandPredicate, expr.Expression, dict, or string
the selection predicate or test predicate for the condition. if a string is passed, it will be treated as a test operand.
- if_true:
the spec or object to use if the selection predicate is true
- if_false:
the spec or object to use if the selection predicate is false
- **kwargs:
additional keyword args are added to the resulting dict
Returns: - spec: dict or VegaLiteSchema
the spec that describes the condition
-
altair.
hconcat
(*charts, **kwargs)¶ Concatenate charts horizontally
-
altair.
layer
(*charts, **kwargs)¶ layer multiple charts
-
altair.
list_datasets
()¶ List the available datasets.
-
altair.
load_dataset
(name)¶ Load a dataset by name as a pandas.DataFrame.
-
altair.
load_schema
()¶ Load the json schema associated with this module’s functions
-
altair.
parse_shorthand
(shorthand, data=None, parse_aggregates=True, parse_window_ops=False, parse_timeunits=True, parse_types=True)¶ General tool to parse shorthand values
These are of the form:
- “col_name”
- “col_name:O”
- “average(col_name)”
- “average(col_name):O”
Optionally, a dataframe may be supplied, from which the type will be inferred if not specified in the shorthand.
Parameters: - shorthand : dict or string
The shorthand representation to be parsed
- data : DataFrame, optional
If specified and of type DataFrame, then use these values to infer the column type if not provided by the shorthand.
- parse_aggregates : boolean
If True (default), then parse aggregate functions within the shorthand.
- parse_window_ops : boolean
If True then parse window operations within the shorthand (default:False)
- parse_timeunits : boolean
If True (default), then parse timeUnits from within the shorthand
- parse_types : boolean
If True (default), then parse typecodes within the shorthand
Returns: - attrs : dict
a dictionary of attributes extracted from the shorthand
Examples
>>> data = pd.DataFrame({'foo': ['A', 'B', 'A', 'B'], ... 'bar': [1, 2, 3, 4]})
>>> parse_shorthand('name') == {'field': 'name'} True
>> parse_shorthand(‘name:Q’) == {‘field’: ‘name’, ‘type’: ‘quantitative’} True
>>> parse_shorthand('average(col)') == {'aggregate': 'average', 'field': 'col'} True
>>> parse_shorthand('foo:O') == {'field': 'foo', 'type': 'ordinal'} True
>>> parse_shorthand('min(foo):Q') == {'aggregate': 'min', 'field': 'foo', 'type': 'quantitative'} True
>>> parse_shorthand('month(col)') == {'field': 'col', 'timeUnit': 'month', 'type': 'temporal'} True
>>> parse_shorthand('year(col):O') == {'field': 'col', 'timeUnit': 'year', 'type': 'ordinal'} True
>>> parse_shorthand('foo', data) == {'field': 'foo', 'type': 'nominal'} True
>>> parse_shorthand('bar', data) == {'field': 'bar', 'type': 'quantitative'} True
>>> parse_shorthand('bar:O', data) == {'field': 'bar', 'type': 'ordinal'} True
>>> parse_shorthand('sum(bar)', data) == {'aggregate': 'sum', 'field': 'bar', 'type': 'quantitative'} True
>>> parse_shorthand('count()', data) == {'aggregate': 'count', 'type': 'quantitative'} True
-
altair.
pipe
(data, *funcs)¶ Pipe a value through a sequence of functions
I.e.
pipe(data, f, g, h)
is equivalent toh(g(f(data)))
We think of the value as progressing through a pipe of several transformations, much like pipes in UNIX
$ cat data | f | g | h
>>> double = lambda i: 2 * i >>> pipe(3, double, str) '6'
- See Also:
- compose thread_first thread_last
-
altair.
repeat
(repeater)¶ Tie a channel to the row or column within a repeated chart
The output of this should be passed to the
field
attribute of a channel.Parameters: - repeater : {‘row’|’column’}
The repeater to tie the field to.
Returns: - repeat : RepeatRef object
-
altair.
selection
(name=None, type=Undefined, **kwds)¶ Create a named selection.
Parameters: - name : string (optional)
The name of the selection. If not specified, a unique name will be created.
- type : string
The type of the selection: one of [“interval”, “single”, or “multi”]
- **kwds :
additional keywords will be used to construct a SelectionDef instance that controls the selection.
Returns: - selection: NamedSelection
The selection object that can be used in chart creation.
-
altair.
selection_interval
(self, type=Undefined, bind=Undefined, empty=Undefined, encodings=Undefined, fields=Undefined, mark=Undefined, on=Undefined, resolve=Undefined, translate=Undefined, zoom=Undefined, **kwds)¶ Create a selection with type=’interval’ Mapping(required=[type])
Attributes: - type : enum(‘interval’)
- bind : enum(‘scales’)
Establishes a two-way binding between the interval selection and the scales used within the same view. This allows a user to interactively pan and zoom the view.
- empty : enum(‘all’, ‘none’)
By default, all data values are considered to lie within an empty selection. When set to
none
, empty selections contain no data values.- encodings : List(SingleDefChannel)
An array of encoding channels. The corresponding data field values must match for a data tuple to fall within the selection.
- fields : List(string)
An array of field names whose values must match for a data tuple to fall within the selection.
- mark : BrushConfig
An interval selection also adds a rectangle mark to depict the extents of the interval. The
mark
property can be used to customize the appearance of the mark.- on : VgEventStream
A Vega event stream (object or selector) that triggers the selection. For interval selections, the event stream must specify a start and end.
- resolve : SelectionResolution
With layered and multi-view displays, a strategy that determines how selections’ data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain.
- translate : anyOf(string, boolean)
When truthy, allows a user to interactively move an interval selection back-and-forth. Can be
true
,false
(to disable panning), or a Vega event stream definition which must include a start and end event to trigger continuous panning.Default value:
true
, which corresponds to[mousedown, window:mouseup] > window:mousemove!
which corresponds to clicks and dragging within an interval selection to reposition it.- zoom : anyOf(string, boolean)
When truthy, allows a user to interactively resize an interval selection. Can be
true
,false
(to disable zooming), or a Vega event stream definition. Currently, onlywheel
events are supported.Default value:
true
, which corresponds towheel!
.
-
altair.
selection_multi
(self, type=Undefined, empty=Undefined, encodings=Undefined, fields=Undefined, nearest=Undefined, on=Undefined, resolve=Undefined, toggle=Undefined, **kwds)¶ Create a selection with type=’multi’ Mapping(required=[type])
Attributes: - type : enum(‘multi’)
- empty : enum(‘all’, ‘none’)
By default, all data values are considered to lie within an empty selection. When set to
none
, empty selections contain no data values.- encodings : List(SingleDefChannel)
An array of encoding channels. The corresponding data field values must match for a data tuple to fall within the selection.
- fields : List(string)
An array of field names whose values must match for a data tuple to fall within the selection.
- nearest : boolean
When true, an invisible voronoi diagram is computed to accelerate discrete selection. The data value nearest the mouse cursor is added to the selection.
See the nearest transform documentation for more information.
- on : VgEventStream
A Vega event stream (object or selector) that triggers the selection. For interval selections, the event stream must specify a start and end.
- resolve : SelectionResolution
With layered and multi-view displays, a strategy that determines how selections’ data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain.
- toggle : anyOf(string, boolean)
Controls whether data values should be toggled or only ever inserted into multi selections. Can be
true
,false
(for insertion only), or a Vega expression.Default value:
true
, which corresponds toevent.shiftKey
(i.e., data values are toggled when a user interacts with the shift-key pressed).See the toggle transform documentation for more information.
-
altair.
selection_single
(self, type=Undefined, bind=Undefined, empty=Undefined, encodings=Undefined, fields=Undefined, nearest=Undefined, on=Undefined, resolve=Undefined, **kwds)¶ Create a selection with type=’single’ Mapping(required=[type])
Attributes: - type : enum(‘single’)
- bind : anyOf(VgBinding, Mapping(required=[]))
Establish a two-way binding between a single selection and input elements (also known as dynamic query widgets). A binding takes the form of Vega’s input element binding definition or can be a mapping between projected field/encodings and binding definitions.
See the bind transform documentation for more information.
- empty : enum(‘all’, ‘none’)
By default, all data values are considered to lie within an empty selection. When set to
none
, empty selections contain no data values.- encodings : List(SingleDefChannel)
An array of encoding channels. The corresponding data field values must match for a data tuple to fall within the selection.
- fields : List(string)
An array of field names whose values must match for a data tuple to fall within the selection.
- nearest : boolean
When true, an invisible voronoi diagram is computed to accelerate discrete selection. The data value nearest the mouse cursor is added to the selection.
See the nearest transform documentation for more information.
- on : VgEventStream
A Vega event stream (object or selector) that triggers the selection. For interval selections, the event stream must specify a start and end.
- resolve : SelectionResolution
With layered and multi-view displays, a strategy that determines how selections’ data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain.
-
altair.
topo_feature
(url, feature, **kwargs)¶ A convenience function for extracting features from a topojson url
Parameters: - url : string
An URL from which to load the data set.
- feature : string
The name of the TopoJSON object set to convert to a GeoJSON feature collection. For example, in a map of the world, there may be an object set named “countries”. Using the feature property, we can extract this set and generate a GeoJSON feature object for each country.
- **kwargs :
additional keywords passed to TopoDataFormat
-
altair.
value
(value, **kwargs)¶ Specify a value for use in an encoding
-
altair.
vconcat
(*charts, **kwargs)¶ Concatenate charts vertically
-
altair.
limit_rows
¶ Raise MaxRowsError if the data model has more than max_rows.
If max_rows is None, then do not perform any check.
-
altair.
sample
¶ Reduce the size of the data model by sampling without replacement.
-
altair.
to_csv
¶ Write the data model to a .csv file and return a url based data model.
-
altair.
to_json
¶ Write the data model to a .json file and return a url based data model.
-
altair.
to_values
¶ Replace a DataFrame by a data model with values.
Vega Expressions¶
Tools for creating transform & filter expressions with a python syntax
-
class
altair.expr.
Expression
(*args, **kwds)¶ Base object for enabling build-up of Javascript expressions using a Python syntax. Calling
repr(obj)
will return a Javascript representation of the object and the operations it encodes.-
to_dict
(*args, **kwargs)¶ Return a dictionary representation of the object
Parameters: - validate : boolean or string
If True (default), then validate the output dictionary against the schema. If “deep” then recursively validate all objects in the spec. This takes much more time, but it results in friendlier tracebacks for large objects.
- ignore : list
A list of keys to ignore. This will not passed to child to_dict function calls.
- context : dict (optional)
A context dictionary that will be passed to all child to_dict function calls
Returns: - dct : dictionary
The dictionary representation of this object
Raises: - jsonschema.ValidationError :
if validate=True and the dict does not conform to the schema
-