From be589f11cf58472382c7470b79d07ea8e57561c0 Mon Sep 17 00:00:00 2001 From: Jake VanderPlas Date: Fri, 22 Nov 2019 21:15:41 -0800 Subject: [PATCH 1/3] ENH: add inheritance structure to core classes --- altair/utils/schemapi.py | 13 +- altair/vega/v4/schema/core.py | 2 +- altair/vega/v5/schema/core.py | 2 +- altair/vegalite/v2/schema/core.py | 7872 ++++++++--------- altair/vegalite/v3/api.py | 9 +- altair/vegalite/v3/schema/core.py | 12730 ++++++++++++++-------------- doc/user_guide/API.rst | 3 + tools/generate_schema_wrapper.py | 73 +- tools/schemapi/codegen.py | 15 +- tools/schemapi/schemapi.py | 13 +- 10 files changed, 10405 insertions(+), 10327 deletions(-) diff --git a/altair/utils/schemapi.py b/altair/utils/schemapi.py index d5ee0869e..f22d7b416 100644 --- a/altair/utils/schemapi.py +++ b/altair/utils/schemapi.py @@ -40,6 +40,17 @@ def debug_mode(arg): DEBUG_MODE = original +def _subclasses(cls): + """Breadth-first sequence of classes which inherit from cls.""" + seen = set() + current_set = {cls} + while current_set: + seen |= current_set + current_set = set.union(*(set(cls.__subclasses__()) for cls in current_set)) + for cls in current_set - seen: + yield cls + + def _todict(obj, validate, context): """Convert an object to a dict representation.""" if isinstance(obj, SchemaBase): @@ -337,7 +348,7 @@ def to_json(self, validate=True, ignore=[], context={}, @classmethod def _default_wrapper_classes(cls): """Return the set of classes used within cls.from_dict()""" - return SchemaBase.__subclasses__() + return _subclasses(SchemaBase) @classmethod def from_dict(cls, dct, validate=True, _wrapper_classes=None): diff --git a/altair/vega/v4/schema/core.py b/altair/vega/v4/schema/core.py index e4268c497..3eab67a9b 100644 --- a/altair/vega/v4/schema/core.py +++ b/altair/vega/v4/schema/core.py @@ -16,7 +16,7 @@ def load_schema(): class VegaSchema(SchemaBase): @classmethod def _default_wrapper_classes(cls): - return VegaSchema.__subclasses__() + return _subclasses(VegaSchema) class Root(VegaSchema): diff --git a/altair/vega/v5/schema/core.py b/altair/vega/v5/schema/core.py index 874a76ba6..dccbcccc4 100644 --- a/altair/vega/v5/schema/core.py +++ b/altair/vega/v5/schema/core.py @@ -16,7 +16,7 @@ def load_schema(): class VegaSchema(SchemaBase): @classmethod def _default_wrapper_classes(cls): - return VegaSchema.__subclasses__() + return _subclasses(VegaSchema) class Root(VegaSchema): diff --git a/altair/vegalite/v2/schema/core.py b/altair/vegalite/v2/schema/core.py index 6518cac28..5ae849357 100644 --- a/altair/vegalite/v2/schema/core.py +++ b/altair/vegalite/v2/schema/core.py @@ -3,7 +3,7 @@ # The contents of this file are automatically written by # tools/generate_schema_wrapper.py. Do not modify directly. -from altair.utils.schemapi import SchemaBase, Undefined +from altair.utils.schemapi import SchemaBase, Undefined, _subclasses import pkgutil import json @@ -16,7 +16,7 @@ def load_schema(): class VegaLiteSchema(SchemaBase): @classmethod def _default_wrapper_classes(cls): - return VegaLiteSchema.__subclasses__() + return _subclasses(VegaLiteSchema) class Root(VegaLiteSchema): @@ -61,27 +61,6 @@ def __init__(self, *args): super(AggregateOp, self).__init__(*args) -class AggregateTransform(VegaLiteSchema): - """AggregateTransform schema wrapper - - Mapping(required=[aggregate]) - - Attributes - ---------- - - aggregate : List(:class:`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. - """ - _schema = {'$ref': '#/definitions/AggregateTransform'} - _rootschema = Root._schema - - def __init__(self, aggregate=Undefined, groupby=Undefined, **kwds): - super(AggregateTransform, self).__init__(aggregate=aggregate, groupby=groupby, **kwds) - - class AggregatedFieldDef(VegaLiteSchema): """AggregatedFieldDef schema wrapper @@ -1001,30 +980,6 @@ def __init__(self, align=Undefined, angle=Undefined, baseline=Undefined, binSpac theta=theta, tooltip=tooltip, **kwds) -class Baseline(VegaLiteSchema): - """Baseline schema wrapper - - enum('top', 'middle', 'bottom') - """ - _schema = {'$ref': '#/definitions/Baseline'} - _rootschema = Root._schema - - def __init__(self, *args): - super(Baseline, self).__init__(*args) - - -class BasicType(VegaLiteSchema): - """BasicType schema wrapper - - enum('quantitative', 'ordinal', 'temporal', 'nominal') - """ - _schema = {'$ref': '#/definitions/BasicType'} - _rootschema = Root._schema - - def __init__(self, *args): - super(BasicType, self).__init__(*args) - - class BinParams(VegaLiteSchema): """BinParams schema wrapper @@ -1081,29 +1036,6 @@ def __init__(self, anchor=Undefined, base=Undefined, divide=Undefined, extent=Un steps=steps, **kwds) -class BinTransform(VegaLiteSchema): - """BinTransform schema wrapper - - Mapping(required=[bin, field, as]) - - Attributes - ---------- - - bin : anyOf(boolean, :class:`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. - """ - _schema = {'$ref': '#/definitions/BinTransform'} - _rootschema = Root._schema - - def __init__(self, bin=Undefined, field=Undefined, **kwds): - super(BinTransform, self).__init__(bin=bin, field=field, **kwds) - - class BrushConfig(VegaLiteSchema): """BrushConfig schema wrapper @@ -1144,29 +1076,8 @@ def __init__(self, fill=Undefined, fillOpacity=Undefined, stroke=Undefined, stro strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, **kwds) -class CalculateTransform(VegaLiteSchema): - """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. - """ - _schema = {'$ref': '#/definitions/CalculateTransform'} - _rootschema = Root._schema - - def __init__(self, calculate=Undefined, **kwds): - super(CalculateTransform, self).__init__(calculate=calculate, **kwds) - - -class CompositeUnitSpec(VegaLiteSchema): - """CompositeUnitSpec schema wrapper +class CompositeUnitSpecAlias(VegaLiteSchema): + """CompositeUnitSpecAlias schema wrapper Mapping(required=[mark]) @@ -1255,16 +1166,17 @@ class CompositeUnitSpec(VegaLiteSchema): **See also:** The documentation for `width and height `__ contains more examples. """ - _schema = {'$ref': '#/definitions/CompositeUnitSpec'} + _schema = {'$ref': '#/definitions/CompositeUnitSpecAlias'} _rootschema = Root._schema def __init__(self, mark=Undefined, data=Undefined, description=Undefined, encoding=Undefined, height=Undefined, name=Undefined, projection=Undefined, selection=Undefined, title=Undefined, transform=Undefined, width=Undefined, **kwds): - super(CompositeUnitSpec, self).__init__(mark=mark, data=data, description=description, - encoding=encoding, height=height, name=name, - projection=projection, selection=selection, title=title, - transform=transform, width=width, **kwds) + super(CompositeUnitSpecAlias, self).__init__(mark=mark, data=data, description=description, + encoding=encoding, height=height, name=name, + projection=projection, selection=selection, + title=title, transform=transform, width=width, + **kwds) class ConditionalFieldDef(VegaLiteSchema): @@ -1292,31 +1204,7 @@ def __init__(self, *args, **kwds): super(ConditionalMarkPropFieldDef, self).__init__(*args, **kwds) -class ConditionalTextFieldDef(VegaLiteSchema): - """ConditionalTextFieldDef schema wrapper - - anyOf(:class:`ConditionalPredicateTextFieldDef`, :class:`ConditionalSelectionTextFieldDef`) - """ - _schema = {'$ref': '#/definitions/ConditionalTextFieldDef'} - _rootschema = Root._schema - - def __init__(self, *args, **kwds): - super(ConditionalTextFieldDef, self).__init__(*args, **kwds) - - -class ConditionalValueDef(VegaLiteSchema): - """ConditionalValueDef schema wrapper - - anyOf(:class:`ConditionalPredicateValueDef`, :class:`ConditionalSelectionValueDef`) - """ - _schema = {'$ref': '#/definitions/ConditionalValueDef'} - _rootschema = Root._schema - - def __init__(self, *args, **kwds): - super(ConditionalValueDef, self).__init__(*args, **kwds) - - -class ConditionalPredicateFieldDef(VegaLiteSchema): +class ConditionalPredicateFieldDef(ConditionalFieldDef): """ConditionalPredicateFieldDef schema wrapper Mapping(required=[test, type]) @@ -1394,7 +1282,7 @@ def __init__(self, test=Undefined, type=Undefined, aggregate=Undefined, bin=Unde title=title, **kwds) -class ConditionalPredicateMarkPropFieldDef(VegaLiteSchema): +class ConditionalPredicateMarkPropFieldDef(ConditionalMarkPropFieldDef): """ConditionalPredicateMarkPropFieldDef schema wrapper Mapping(required=[test, type]) @@ -1518,110 +1406,7 @@ def __init__(self, test=Undefined, type=Undefined, aggregate=Undefined, bin=Unde **kwds) -class ConditionalPredicateTextFieldDef(VegaLiteSchema): - """ConditionalPredicateTextFieldDef schema wrapper - - Mapping(required=[test, type]) - - Attributes - ---------- - - test : :class:`LogicalOperandPredicate` - - type : :class:`Type` - The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, - ``"ordinal"``, or ``"nominal"`` ). - It can also be a ``"geojson"`` type for encoding `'geoshape' - `__. - aggregate : :class:`Aggregate` - Aggregation function for the field - (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). - - **Default value:** ``undefined`` (None) - bin : anyOf(boolean, :class:`BinParams`) - A flag for binning a ``quantitative`` field, or `an object defining binning - parameters `__. - If ``true``, default `binning parameters - `__ will be applied. - - **Default value:** ``false`` - field : anyOf(string, :class:`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 if ``aggregate`` is ``count``. - format : string - The `formatting pattern `__ for a - text field. If not defined, this will be determined automatically. - timeUnit : :class:`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`` and ``timeUnit`` ). 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 legend ``title`` are - defined, axis/header/legend title will be used. - """ - _schema = {'$ref': '#/definitions/ConditionalPredicate'} - _rootschema = Root._schema - - def __init__(self, test=Undefined, type=Undefined, aggregate=Undefined, bin=Undefined, - field=Undefined, format=Undefined, timeUnit=Undefined, title=Undefined, **kwds): - super(ConditionalPredicateTextFieldDef, self).__init__(test=test, type=type, - aggregate=aggregate, bin=bin, - field=field, format=format, - timeUnit=timeUnit, title=title, **kwds) - - -class ConditionalPredicateValueDef(VegaLiteSchema): - """ConditionalPredicateValueDef schema wrapper - - Mapping(required=[test, value]) - - Attributes - ---------- - - test : :class:`LogicalOperandPredicate` - - value : anyOf(float, string, boolean) - A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values - between ``0`` to ``1`` for opacity). - """ - _schema = {'$ref': '#/definitions/ConditionalPredicate'} - _rootschema = Root._schema - - def __init__(self, test=Undefined, value=Undefined, **kwds): - super(ConditionalPredicateValueDef, self).__init__(test=test, value=value, **kwds) - - -class ConditionalSelectionFieldDef(VegaLiteSchema): +class ConditionalSelectionFieldDef(ConditionalFieldDef): """ConditionalSelectionFieldDef schema wrapper Mapping(required=[selection, type]) @@ -1701,7 +1486,7 @@ def __init__(self, selection=Undefined, type=Undefined, aggregate=Undefined, bin timeUnit=timeUnit, title=title, **kwds) -class ConditionalSelectionMarkPropFieldDef(VegaLiteSchema): +class ConditionalSelectionMarkPropFieldDef(ConditionalMarkPropFieldDef): """ConditionalSelectionMarkPropFieldDef schema wrapper Mapping(required=[selection, type]) @@ -1827,18 +1612,28 @@ def __init__(self, selection=Undefined, type=Undefined, aggregate=Undefined, bin **kwds) -class ConditionalSelectionTextFieldDef(VegaLiteSchema): - """ConditionalSelectionTextFieldDef schema wrapper +class ConditionalTextFieldDef(VegaLiteSchema): + """ConditionalTextFieldDef schema wrapper - Mapping(required=[selection, type]) + anyOf(:class:`ConditionalPredicateTextFieldDef`, :class:`ConditionalSelectionTextFieldDef`) + """ + _schema = {'$ref': '#/definitions/ConditionalTextFieldDef'} + _rootschema = Root._schema + + def __init__(self, *args, **kwds): + super(ConditionalTextFieldDef, self).__init__(*args, **kwds) + + +class ConditionalPredicateTextFieldDef(ConditionalTextFieldDef): + """ConditionalPredicateTextFieldDef schema wrapper + + Mapping(required=[test, type]) Attributes ---------- - selection : :class:`SelectionOperand` - A `selection name `__, or a - series of `composed selections - `__. + test : :class:`LogicalOperandPredicate` + type : :class:`Type` The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, ``"ordinal"``, or ``"nominal"`` ). @@ -1900,21 +1695,21 @@ class ConditionalSelectionTextFieldDef(VegaLiteSchema): 2) If both field definition's ``title`` and axis, header, or legend ``title`` are defined, axis/header/legend title will be used. """ - _schema = {'$ref': '#/definitions/ConditionalSelection'} + _schema = {'$ref': '#/definitions/ConditionalPredicate'} _rootschema = Root._schema - def __init__(self, selection=Undefined, type=Undefined, aggregate=Undefined, bin=Undefined, + def __init__(self, test=Undefined, type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, format=Undefined, timeUnit=Undefined, title=Undefined, **kwds): - super(ConditionalSelectionTextFieldDef, self).__init__(selection=selection, type=type, + super(ConditionalPredicateTextFieldDef, self).__init__(test=test, type=type, aggregate=aggregate, bin=bin, field=field, format=format, timeUnit=timeUnit, title=title, **kwds) -class ConditionalSelectionValueDef(VegaLiteSchema): - """ConditionalSelectionValueDef schema wrapper +class ConditionalSelectionTextFieldDef(ConditionalTextFieldDef): + """ConditionalSelectionTextFieldDef schema wrapper - Mapping(required=[selection, value]) + Mapping(required=[selection, type]) Attributes ---------- @@ -1923,7 +1718,124 @@ class ConditionalSelectionValueDef(VegaLiteSchema): A `selection name `__, or a series of `composed selections `__. - value : anyOf(float, string, boolean) + type : :class:`Type` + The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, + ``"ordinal"``, or ``"nominal"`` ). + It can also be a ``"geojson"`` type for encoding `'geoshape' + `__. + aggregate : :class:`Aggregate` + Aggregation function for the field + (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). + + **Default value:** ``undefined`` (None) + bin : anyOf(boolean, :class:`BinParams`) + A flag for binning a ``quantitative`` field, or `an object defining binning + parameters `__. + If ``true``, default `binning parameters + `__ will be applied. + + **Default value:** ``false`` + field : anyOf(string, :class:`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 if ``aggregate`` is ``count``. + format : string + The `formatting pattern `__ for a + text field. If not defined, this will be determined automatically. + timeUnit : :class:`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`` and ``timeUnit`` ). 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 legend ``title`` are + defined, axis/header/legend title will be used. + """ + _schema = {'$ref': '#/definitions/ConditionalSelection'} + _rootschema = Root._schema + + def __init__(self, selection=Undefined, type=Undefined, aggregate=Undefined, bin=Undefined, + field=Undefined, format=Undefined, timeUnit=Undefined, title=Undefined, **kwds): + super(ConditionalSelectionTextFieldDef, self).__init__(selection=selection, type=type, + aggregate=aggregate, bin=bin, + field=field, format=format, + timeUnit=timeUnit, title=title, **kwds) + + +class ConditionalValueDef(VegaLiteSchema): + """ConditionalValueDef schema wrapper + + anyOf(:class:`ConditionalPredicateValueDef`, :class:`ConditionalSelectionValueDef`) + """ + _schema = {'$ref': '#/definitions/ConditionalValueDef'} + _rootschema = Root._schema + + def __init__(self, *args, **kwds): + super(ConditionalValueDef, self).__init__(*args, **kwds) + + +class ConditionalPredicateValueDef(ConditionalValueDef): + """ConditionalPredicateValueDef schema wrapper + + Mapping(required=[test, value]) + + Attributes + ---------- + + test : :class:`LogicalOperandPredicate` + + value : anyOf(float, string, boolean) + A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values + between ``0`` to ``1`` for opacity). + """ + _schema = {'$ref': '#/definitions/ConditionalPredicate'} + _rootschema = Root._schema + + def __init__(self, test=Undefined, value=Undefined, **kwds): + super(ConditionalPredicateValueDef, self).__init__(test=test, value=value, **kwds) + + +class ConditionalSelectionValueDef(ConditionalValueDef): + """ConditionalSelectionValueDef schema wrapper + + Mapping(required=[selection, value]) + + Attributes + ---------- + + selection : :class:`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 between ``0`` to ``1`` for opacity). """ @@ -2114,45 +2026,6 @@ def __init__(self, area=Undefined, autosize=Undefined, axis=Undefined, axisBand= title=title, trail=trail, view=view, **kwds) -class CsvDataFormat(VegaLiteSchema): - """CsvDataFormat schema wrapper - - Mapping(required=[]) - - Attributes - ---------- - - parse : anyOf(enum('auto'), :class:`Parse`, None) - If set to ``"auto"`` (the default), perform automatic type inference to determine - the desired data types. - If set to ``null``, 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 the ``modified_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. - """ - _schema = {'$ref': '#/definitions/CsvDataFormat'} - _rootschema = Root._schema - - def __init__(self, parse=Undefined, type=Undefined, **kwds): - super(CsvDataFormat, self).__init__(parse=parse, type=type, **kwds) - - class Cursor(VegaLiteSchema): """Cursor schema wrapper @@ -2194,6 +2067,45 @@ def __init__(self, *args, **kwds): super(DataFormat, self).__init__(*args, **kwds) +class CsvDataFormat(DataFormat): + """CsvDataFormat schema wrapper + + Mapping(required=[]) + + Attributes + ---------- + + parse : anyOf(enum('auto'), :class:`Parse`, None) + If set to ``"auto"`` (the default), perform automatic type inference to determine + the desired data types. + If set to ``null``, 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 the ``modified_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. + """ + _schema = {'$ref': '#/definitions/CsvDataFormat'} + _rootschema = Root._schema + + def __init__(self, parse=Undefined, type=Undefined, **kwds): + super(CsvDataFormat, self).__init__(parse=parse, type=type, **kwds) + + class Datasets(VegaLiteSchema): """Datasets schema wrapper @@ -2293,7 +2205,7 @@ def __init__(self, *args): super(Dir, self).__init__(*args) -class DsvDataFormat(VegaLiteSchema): +class DsvDataFormat(DataFormat): """DsvDataFormat schema wrapper Mapping(required=[delimiter]) @@ -2468,41 +2380,6 @@ def __init__(self, color=Undefined, detail=Undefined, fill=Undefined, href=Undef y=y, y2=y2, **kwds) -class EncodingSortField(VegaLiteSchema): - """EncodingSortField schema wrapper - - Mapping(required=[op]) - A sort definition for sorting a discrete scale in an encoding field definition. - - Attributes - ---------- - - op : :class:`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, :class:`RepeatRef`) - The data `field `__ to sort by. - - **Default value:** If unspecified, defaults to the field specified in the outer data - reference. - order : :class:`SortOrder` - The sort order. One of ``"ascending"`` (default), ``"descending"``, or ``null`` (no - not sort). - """ - _schema = {'$ref': '#/definitions/EncodingSortField'} - _rootschema = Root._schema - - def __init__(self, op=Undefined, field=Undefined, order=Undefined, **kwds): - super(EncodingSortField, self).__init__(op=op, field=field, order=order, **kwds) - - class EncodingWithFacet(VegaLiteSchema): """EncodingWithFacet schema wrapper @@ -2641,125 +2518,22 @@ def __init__(self, color=Undefined, column=Undefined, detail=Undefined, fill=Und **kwds) -class LayerSpec(VegaLiteSchema): - """LayerSpec schema wrapper +class FacetFieldDef(VegaLiteSchema): + """FacetFieldDef schema wrapper - Mapping(required=[layer]) - Layer Spec with encoding and projection + Mapping(required=[type]) Attributes ---------- - layer : List(anyOf(:class:`LayerSpec`, :class:`CompositeUnitSpec`)) - Layer or single view specifications to be layered. - - **Note** : Specifications inside ``layer`` cannot use ``row`` and ``column`` - channels as layering facet specifications is not allowed. - data : :class:`Data` - An object describing the data source - description : string - Description of this mark for commenting purpose. - encoding : :class:`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`` is ``null``, the height will be the value of `config.view.height - `__. - * If no field is mapped to ``y`` channel, the ``height`` will be the value of - ``rangeStep``. - - **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. - name : string - Name of the visualization for later reference. - projection : :class:`Projection` - An object defining properties of the geographic projection shared by underlying - layers. - resolve : :class:`Resolve` - Scale, axis, and legend resolutions for layers. - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`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`` is ``null``, the width will be the value of `config.view.width - `__. - * If no field is mapped to ``x`` channel, the ``width`` will be the value of - `config.scale.textXRangeStep - `__ for - ``text`` mark and the value of ``rangeStep`` 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. - """ - _schema = {'$ref': '#/definitions/LayerSpec'} - _rootschema = Root._schema - - def __init__(self, layer=Undefined, data=Undefined, description=Undefined, encoding=Undefined, - height=Undefined, name=Undefined, projection=Undefined, resolve=Undefined, - title=Undefined, transform=Undefined, width=Undefined, **kwds): - super(LayerSpec, self).__init__(layer=layer, data=data, description=description, - encoding=encoding, height=height, name=name, - projection=projection, resolve=resolve, title=title, - transform=transform, width=width, **kwds) - - -class FacetFieldDef(VegaLiteSchema): - """FacetFieldDef schema wrapper - - Mapping(required=[type]) - - Attributes - ---------- - - type : :class:`Type` - The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, - ``"ordinal"``, or ``"nominal"`` ). - It can also be a ``"geojson"`` type for encoding `'geoshape' - `__. - aggregate : :class:`Aggregate` - Aggregation function for the field - (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). + type : :class:`Type` + The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, + ``"ordinal"``, or ``"nominal"`` ). + It can also be a ``"geojson"`` type for encoding `'geoshape' + `__. + aggregate : :class:`Aggregate` + Aggregation function for the field + (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). **Default value:** ``undefined`` (None) bin : anyOf(boolean, :class:`BinParams`) @@ -2868,6 +2642,110 @@ def __init__(self, column=Undefined, row=Undefined, **kwds): super(FacetMapping, self).__init__(column=column, row=row, **kwds) +class FacetedCompositeUnitSpecAlias(VegaLiteSchema): + """FacetedCompositeUnitSpecAlias schema wrapper + + Mapping(required=[mark]) + + Attributes + ---------- + + mark : :class:`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 : :class:`Data` + An object describing the data source + description : string + Description of this mark for commenting purpose. + encoding : :class:`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`` is ``null``, the height will be the value of `config.view.height + `__. + * If no field is mapped to ``y`` channel, the ``height`` will be the value of + ``rangeStep``. + + **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. + name : string + Name of the visualization for later reference. + projection : :class:`Projection` + An object defining properties of geographic projection, which will be applied to + ``shape`` path for ``"geoshape"`` marks + and to ``latitude`` and ``"longitude"`` channels for other marks. + selection : Mapping(required=[]) + A key-value mapping between selection names and definitions. + title : anyOf(string, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`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`` is ``null``, the width will be the value of `config.view.width + `__. + * If no field is mapped to ``x`` channel, the ``width`` will be the value of + `config.scale.textXRangeStep + `__ for + ``text`` mark and the value of ``rangeStep`` 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. + """ + _schema = {'$ref': '#/definitions/FacetedCompositeUnitSpecAlias'} + _rootschema = Root._schema + + def __init__(self, mark=Undefined, data=Undefined, description=Undefined, encoding=Undefined, + height=Undefined, name=Undefined, projection=Undefined, selection=Undefined, + title=Undefined, transform=Undefined, width=Undefined, **kwds): + super(FacetedCompositeUnitSpecAlias, self).__init__(mark=mark, data=data, + description=description, encoding=encoding, + height=height, name=name, + projection=projection, selection=selection, + title=title, transform=transform, + width=width, **kwds) + + class FieldDef(VegaLiteSchema): """FieldDef schema wrapper @@ -3027,189 +2905,92 @@ def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, condition title=title, **kwds) -class MarkPropFieldDefWithCondition(VegaLiteSchema): - """MarkPropFieldDefWithCondition schema wrapper +class FontStyle(VegaLiteSchema): + """FontStyle schema wrapper - Mapping(required=[type]) - A FieldDef with Condition :raw-html:`` + enum('normal', 'italic') + """ + _schema = {'$ref': '#/definitions/FontStyle'} + _rootschema = Root._schema - Attributes - ---------- + def __init__(self, *args): + super(FontStyle, self).__init__(*args) - type : :class:`Type` - The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, - ``"ordinal"``, or ``"nominal"`` ). - It can also be a ``"geojson"`` type for encoding `'geoshape' - `__. - aggregate : :class:`Aggregate` - Aggregation function for the field - (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). - **Default value:** ``undefined`` (None) - bin : anyOf(boolean, :class:`BinParams`) - A flag for binning a ``quantitative`` field, or `an object defining binning - parameters `__. - If ``true``, default `binning parameters - `__ will be applied. +class FontWeight(VegaLiteSchema): + """FontWeight schema wrapper - **Default value:** ``false`` - condition : anyOf(:class:`ConditionalValueDef`, List(:class:`ConditionalValueDef`)) - One or more value definition(s) with a selection predicate. + anyOf(:class:`FontWeightString`, :class:`FontWeightNumber`) + """ + _schema = {'$ref': '#/definitions/FontWeight'} + _rootschema = Root._schema - **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, :class:`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. + def __init__(self, *args, **kwds): + super(FontWeight, self).__init__(*args, **kwds) - **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 if ``aggregate`` is ``count``. - legend : anyOf(:class:`Legend`, None) - An object defining properties of the legend. - If ``null``, the legend for the encoding channel will be removed. +class FontWeightNumber(FontWeight): + """FontWeightNumber schema wrapper - **Default value:** If undefined, default `legend properties - `__ are applied. - scale : anyOf(:class:`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 : :class:`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 for ``row`` and ``column``. - timeUnit : :class:`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. + float + """ + _schema = {'$ref': '#/definitions/FontWeightNumber'} + _rootschema = Root._schema - **Default value:** derived from the field's name and transformation function ( - ``aggregate``, ``bin`` and ``timeUnit`` ). 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. + def __init__(self, *args): + super(FontWeightNumber, self).__init__(*args) - **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 - `__. +class FontWeightString(FontWeight): + """FontWeightString schema wrapper - 2) If both field definition's ``title`` and axis, header, or legend ``title`` are - defined, axis/header/legend title will be used. + enum('normal', 'bold') """ - _schema = {'$ref': '#/definitions/MarkPropFieldDefWithCondition'} + _schema = {'$ref': '#/definitions/FontWeightString'} _rootschema = Root._schema - def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, - field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, - title=Undefined, **kwds): - super(MarkPropFieldDefWithCondition, self).__init__(type=type, aggregate=aggregate, bin=bin, - condition=condition, field=field, - legend=legend, scale=scale, sort=sort, - timeUnit=timeUnit, title=title, **kwds) + def __init__(self, *args): + super(FontWeightString, self).__init__(*args) -class TextFieldDefWithCondition(VegaLiteSchema): - """TextFieldDefWithCondition schema wrapper +class Header(VegaLiteSchema): + """Header schema wrapper - Mapping(required=[type]) - A FieldDef with Condition :raw-html:`` + Mapping(required=[]) + Headers of row / column channels for faceted plots. Attributes ---------- - type : :class:`Type` - The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, - ``"ordinal"``, or ``"nominal"`` ). - It can also be a ``"geojson"`` type for encoding `'geoshape' - `__. - aggregate : :class:`Aggregate` - Aggregation function for the field - (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). - - **Default value:** ``undefined`` (None) - bin : anyOf(boolean, :class:`BinParams`) - A flag for binning a ``quantitative`` field, or `an object defining binning - parameters `__. - If ``true``, default `binning parameters - `__ will be applied. - - **Default value:** ``false`` - condition : anyOf(:class:`ConditionalValueDef`, List(:class:`ConditionalValueDef`)) - One or more value definition(s) with a selection predicate. + 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. - **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, :class:`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. + See the `format documentation `__ + for more information. - **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 - `__. + **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. - **Note:** ``field`` is not required if ``aggregate`` is ``count``. - format : string - The `formatting pattern `__ for a - text field. If not defined, this will be determined automatically. - timeUnit : :class:`TimeUnit` - Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal - field. - or `a temporal field that gets casted as ordinal - `__. + **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:** ``undefined`` (None) + **Default value:** ``0``, indicating no limit title : anyOf(string, None) A title for the field. If ``null``, the title will be removed. @@ -3229,1458 +3010,1114 @@ class TextFieldDefWithCondition(VegaLiteSchema): 2) If both field definition's ``title`` and axis, header, or legend ``title`` are defined, axis/header/legend title will be used. - """ - _schema = {'$ref': '#/definitions/TextFieldDefWithCondition'} - _rootschema = Root._schema - - def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, - field=Undefined, format=Undefined, timeUnit=Undefined, title=Undefined, **kwds): - super(TextFieldDefWithCondition, self).__init__(type=type, aggregate=aggregate, bin=bin, - condition=condition, field=field, format=format, - timeUnit=timeUnit, title=title, **kwds) + 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 + `__ and `layered + `__ views. + ``"start"`` for other composite views. -class FieldEqualPredicate(VegaLiteSchema): - """FieldEqualPredicate schema wrapper + **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. - Mapping(required=[equal, field]) + **Default value:** ``0``. + titleBaseline : :class:`TextBaseline` + Vertical text baseline for the header title. One of ``"top"``, ``"bottom"``, + ``"middle"``. - Attributes - ---------- + **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 : :class:`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. - equal : anyOf(string, float, boolean, :class:`DateTime`) - The value that the field should be equal to. - field : string - Field to be filtered. - timeUnit : :class:`TimeUnit` - Time unit for the field to be filtered. + **Default value:** ``0``, indicating no limit """ - _schema = {'$ref': '#/definitions/FieldEqualPredicate'} + _schema = {'$ref': '#/definitions/Header'} _rootschema = Root._schema - def __init__(self, equal=Undefined, field=Undefined, timeUnit=Undefined, **kwds): - super(FieldEqualPredicate, self).__init__(equal=equal, field=field, timeUnit=timeUnit, **kwds) + def __init__(self, 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): + super(Header, self).__init__(format=format, labelAngle=labelAngle, labelColor=labelColor, + labelFont=labelFont, labelFontSize=labelFontSize, + labelLimit=labelLimit, title=title, titleAnchor=titleAnchor, + titleAngle=titleAngle, titleBaseline=titleBaseline, + titleColor=titleColor, titleFont=titleFont, + titleFontSize=titleFontSize, titleFontWeight=titleFontWeight, + titleLimit=titleLimit, **kwds) -class FieldGTEPredicate(VegaLiteSchema): - """FieldGTEPredicate schema wrapper +class HeaderConfig(VegaLiteSchema): + """HeaderConfig schema wrapper - Mapping(required=[field, gte]) + Mapping(required=[]) Attributes ---------- - field : string - Field to be filtered. - gte : anyOf(string, float, :class:`DateTime`) - The value that the field should be greater than or equals to. - timeUnit : :class:`TimeUnit` - Time unit for the field to be filtered. - """ - _schema = {'$ref': '#/definitions/FieldGTEPredicate'} - _rootschema = Root._schema - - def __init__(self, field=Undefined, gte=Undefined, timeUnit=Undefined, **kwds): - super(FieldGTEPredicate, self).__init__(field=field, gte=gte, timeUnit=timeUnit, **kwds) - + labelAngle : float + The rotation angle of the header labels. -class FieldGTPredicate(VegaLiteSchema): - """FieldGTPredicate schema wrapper + **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. - Mapping(required=[field, gt]) + **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. - Attributes - ---------- + **Default value:** ``"middle"`` for `single + `__ and `layered + `__ views. + ``"start"`` for other composite views. - field : string - Field to be filtered. - gt : anyOf(string, float, :class:`DateTime`) - The value that the field should be greater than. - timeUnit : :class:`TimeUnit` - Time unit for the field to be filtered. - """ - _schema = {'$ref': '#/definitions/FieldGTPredicate'} - _rootschema = Root._schema + **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. - def __init__(self, field=Undefined, gt=Undefined, timeUnit=Undefined, **kwds): - super(FieldGTPredicate, self).__init__(field=field, gt=gt, timeUnit=timeUnit, **kwds) + **Default value:** ``0``. + titleBaseline : :class:`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 : :class:`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. -class FieldLTEPredicate(VegaLiteSchema): - """FieldLTEPredicate schema wrapper + **Default value:** ``0``, indicating no limit + """ + _schema = {'$ref': '#/definitions/HeaderConfig'} + _rootschema = Root._schema - Mapping(required=[field, lte]) + def __init__(self, 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): + super(HeaderConfig, self).__init__(labelAngle=labelAngle, labelColor=labelColor, + labelFont=labelFont, labelFontSize=labelFontSize, + labelLimit=labelLimit, titleAnchor=titleAnchor, + titleAngle=titleAngle, titleBaseline=titleBaseline, + titleColor=titleColor, titleFont=titleFont, + titleFontSize=titleFontSize, titleFontWeight=titleFontWeight, + titleLimit=titleLimit, **kwds) - Attributes - ---------- - field : string - Field to be filtered. - lte : anyOf(string, float, :class:`DateTime`) - The value that the field should be less than or equals to. - timeUnit : :class:`TimeUnit` - Time unit for the field to be filtered. +class HorizontalAlign(VegaLiteSchema): + """HorizontalAlign schema wrapper + + enum('left', 'right', 'center') """ - _schema = {'$ref': '#/definitions/FieldLTEPredicate'} + _schema = {'$ref': '#/definitions/HorizontalAlign'} _rootschema = Root._schema - def __init__(self, field=Undefined, lte=Undefined, timeUnit=Undefined, **kwds): - super(FieldLTEPredicate, self).__init__(field=field, lte=lte, timeUnit=timeUnit, **kwds) + def __init__(self, *args): + super(HorizontalAlign, self).__init__(*args) -class FieldLTPredicate(VegaLiteSchema): - """FieldLTPredicate schema wrapper +class InlineData(Data): + """InlineData schema wrapper - Mapping(required=[field, lt]) + Mapping(required=[values]) Attributes ---------- - field : string - Field to be filtered. - lt : anyOf(string, float, :class:`DateTime`) - The value that the field should be less than. - timeUnit : :class:`TimeUnit` - Time unit for the field to be filtered. + values : :class:`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 : :class:`DataFormat` + An object that specifies the format for parsing the data. + name : string + Provide a placeholder name and bind data at runtime. """ - _schema = {'$ref': '#/definitions/FieldLTPredicate'} + _schema = {'$ref': '#/definitions/InlineData'} _rootschema = Root._schema - def __init__(self, field=Undefined, lt=Undefined, timeUnit=Undefined, **kwds): - super(FieldLTPredicate, self).__init__(field=field, lt=lt, timeUnit=timeUnit, **kwds) - - -class FieldOneOfPredicate(VegaLiteSchema): - """FieldOneOfPredicate schema wrapper + def __init__(self, values=Undefined, format=Undefined, name=Undefined, **kwds): + super(InlineData, self).__init__(values=values, format=format, name=name, **kwds) - Mapping(required=[field, oneOf]) - Attributes - ---------- +class InlineDataset(VegaLiteSchema): + """InlineDataset schema wrapper - field : string - Field to be filtered. - oneOf : anyOf(List(string), List(float), List(boolean), List(:class:`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 : :class:`TimeUnit` - Time unit for the field to be filtered. + anyOf(List(float), List(string), List(boolean), List(Mapping(required=[])), string, + Mapping(required=[])) """ - _schema = {'$ref': '#/definitions/FieldOneOfPredicate'} + _schema = {'$ref': '#/definitions/InlineDataset'} _rootschema = Root._schema - def __init__(self, field=Undefined, oneOf=Undefined, timeUnit=Undefined, **kwds): - super(FieldOneOfPredicate, self).__init__(field=field, oneOf=oneOf, timeUnit=timeUnit, **kwds) - - -class FieldRangePredicate(VegaLiteSchema): - """FieldRangePredicate schema wrapper + def __init__(self, *args, **kwds): + super(InlineDataset, self).__init__(*args, **kwds) - Mapping(required=[field, range]) - Attributes - ---------- +class Interpolate(VegaLiteSchema): + """Interpolate schema wrapper - field : string - Field to be filtered. - range : List(anyOf(float, :class:`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 : :class:`TimeUnit` - Time unit for the field to be filtered. + enum('linear', 'linear-closed', 'step', 'step-before', 'step-after', 'basis', 'basis-open', + 'basis-closed', 'cardinal', 'cardinal-open', 'cardinal-closed', 'bundle', 'monotone') """ - _schema = {'$ref': '#/definitions/FieldRangePredicate'} + _schema = {'$ref': '#/definitions/Interpolate'} _rootschema = Root._schema - def __init__(self, field=Undefined, range=Undefined, timeUnit=Undefined, **kwds): - super(FieldRangePredicate, self).__init__(field=field, range=range, timeUnit=timeUnit, **kwds) + def __init__(self, *args): + super(Interpolate, self).__init__(*args) -class FilterTransform(VegaLiteSchema): - """FilterTransform schema wrapper +class IntervalSelectionConfig(VegaLiteSchema): + """IntervalSelectionConfig schema wrapper - Mapping(required=[filter]) + Mapping(required=[]) Attributes ---------- - filter : :class:`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 object - - 2) one of the field predicates: `equal - `__, - `lt `__, - `lte `__, - `gt `__, - `gte `__, - `range `__, - or `oneOf `__. + 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(:class:`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 : :class:`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 : :class:`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 : :class:`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. - 3) a `selection predicate - `__ + **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, + only ``wheel`` events are supported. - 4) a logical operand that combines (1), (2), or (3). + **Default value:** ``true``, which corresponds to ``wheel!``. """ - _schema = {'$ref': '#/definitions/FilterTransform'} + _schema = {'$ref': '#/definitions/IntervalSelectionConfig'} _rootschema = Root._schema - def __init__(self, filter=Undefined, **kwds): - super(FilterTransform, self).__init__(filter=filter, **kwds) - + def __init__(self, bind=Undefined, empty=Undefined, encodings=Undefined, fields=Undefined, + mark=Undefined, on=Undefined, resolve=Undefined, translate=Undefined, zoom=Undefined, + **kwds): + super(IntervalSelectionConfig, self).__init__(bind=bind, empty=empty, encodings=encodings, + fields=fields, mark=mark, on=on, resolve=resolve, + translate=translate, zoom=zoom, **kwds) -class FontStyle(VegaLiteSchema): - """FontStyle schema wrapper - enum('normal', 'italic') - """ - _schema = {'$ref': '#/definitions/FontStyle'} - _rootschema = Root._schema +class JsonDataFormat(DataFormat): + """JsonDataFormat schema wrapper - def __init__(self, *args): - super(FontStyle, self).__init__(*args) + Mapping(required=[]) + Attributes + ---------- -class FontWeight(VegaLiteSchema): - """FontWeight schema wrapper + parse : anyOf(enum('auto'), :class:`Parse`, None) + If set to ``"auto"`` (the default), perform automatic type inference to determine + the desired data types. + If set to ``null``, 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 the ``modified_on`` field + in each input record a Date value. - anyOf(:class:`FontWeightString`, :class:`FontWeightNumber`) - """ - _schema = {'$ref': '#/definitions/FontWeight'} - _rootschema = Root._schema - - def __init__(self, *args, **kwds): - super(FontWeight, self).__init__(*args, **kwds) - - -class FontWeightNumber(VegaLiteSchema): - """FontWeightNumber schema wrapper - - float - """ - _schema = {'$ref': '#/definitions/FontWeightNumber'} - _rootschema = Root._schema - - def __init__(self, *args): - super(FontWeightNumber, self).__init__(*args) - - -class FontWeightString(VegaLiteSchema): - """FontWeightString schema wrapper - - enum('normal', 'bold') + 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 retrieving + ``json.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. """ - _schema = {'$ref': '#/definitions/FontWeightString'} + _schema = {'$ref': '#/definitions/JsonDataFormat'} _rootschema = Root._schema - def __init__(self, *args): - super(FontWeightString, self).__init__(*args) + def __init__(self, parse=Undefined, property=Undefined, type=Undefined, **kwds): + super(JsonDataFormat, self).__init__(parse=parse, property=property, type=type, **kwds) -class FacetSpec(VegaLiteSchema): - """FacetSpec schema wrapper +class Legend(VegaLiteSchema): + """Legend schema wrapper - Mapping(required=[facet, spec]) + Mapping(required=[]) + Properties of a legend or boolean flag for determining whether to show it. Attributes ---------- - facet : :class:`FacetMapping` - An object that describes mappings between ``row`` and ``column`` channels and their - field definitions. - spec : anyOf(:class:`LayerSpec`, :class:`CompositeUnitSpec`) - A specification of the view that gets faceted. - align : anyOf(:class:`VgLayoutAlign`, :class:`RowColVgLayoutAlign`) - The alignment to apply to grid rows and columns. - The supported string values are ``"all"``, ``"each"``, and ``"none"``. - + 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. - * 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. + See the `format documentation `__ + for more information. - Alternatively, an object value of the form ``{"row": string, "column": string}`` can - be used to supply different alignments for rows and columns. + **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:** ``"all"``. - bounds : enum('full', 'flush') - The bounds calculation method to use for determining the extent of a sub-plot. One - of ``full`` (the default) or ``flush``. + **Default value:** ``0`` + orient : :class:`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. - * If set to ``full``, the entire calculated bounds (including axes, title, and - legend) will be used. - * If set to ``flush``, 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:** derived from the field's name and transformation function ( + ``aggregate``, ``bin`` and ``timeUnit`` ). 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. - **Default value:** ``"full"`` - center : anyOf(boolean, :class:`RowColboolean`) - Boolean flag indicating if subviews should be centered relative to their respective - rows or columns. + **Notes** : - An object value of the form ``{"row": boolean, "column": boolean}`` can be used to - supply different centering values for rows and columns. + 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 + `__. - **Default value:** ``false`` - data : :class:`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 : :class:`Resolve` - Scale, axis, and legend resolutions for facets. - spacing : anyOf(float, :class:`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. + 2) If both field definition's ``title`` and axis, header, or legend ``title`` 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 + ``"gradient"`` for a continuous color gradient. - **Default value** : ``10`` - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`Transform`) - An array of data transformations such as filter and new field calculation. + **Default value:** ``"gradient"`` for non-binned quantitative fields and temporal + fields; ``"symbol"`` otherwise. + values : anyOf(List(float), List(string), List(boolean), List(:class:`DateTime`)) + 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. """ - _schema = {'$ref': '#/definitions/FacetSpec'} + _schema = {'$ref': '#/definitions/Legend'} _rootschema = Root._schema - def __init__(self, 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): - super(FacetSpec, self).__init__(facet=facet, spec=spec, align=align, bounds=bounds, - center=center, data=data, description=description, name=name, - resolve=resolve, spacing=spacing, title=title, - transform=transform, **kwds) + def __init__(self, entryPadding=Undefined, format=Undefined, offset=Undefined, orient=Undefined, + padding=Undefined, tickCount=Undefined, title=Undefined, type=Undefined, + values=Undefined, zindex=Undefined, **kwds): + super(Legend, self).__init__(entryPadding=entryPadding, format=format, offset=offset, + orient=orient, padding=padding, tickCount=tickCount, title=title, + type=type, values=values, zindex=zindex, **kwds) -class HConcatSpec(VegaLiteSchema): - """HConcatSpec schema wrapper +class LegendConfig(VegaLiteSchema): + """LegendConfig schema wrapper - Mapping(required=[hconcat]) + Mapping(required=[]) Attributes ---------- - hconcat : List(:class:`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) or ``flush``. - + 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. - * If set to ``full``, the entire calculated bounds (including axes, title, and - legend) will be used. - * If set to ``flush``, 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:** ``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:** ``"full"`` - center : boolean - Boolean flag indicating if subviews should be centered relative to their respective - rows or columns. + **Default value:** ``0`` + orient : :class:`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:** ``false`` - data : :class:`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 : :class:`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:** ``"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** : ``10`` - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`Transform`) - An array of data transformations such as filter and new field calculation. - """ - _schema = {'$ref': '#/definitions/HConcatSpec'} + **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 : :class:`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. + """ + _schema = {'$ref': '#/definitions/LegendConfig'} _rootschema = Root._schema - def __init__(self, hconcat=Undefined, bounds=Undefined, center=Undefined, data=Undefined, - description=Undefined, name=Undefined, resolve=Undefined, spacing=Undefined, - title=Undefined, transform=Undefined, **kwds): - super(HConcatSpec, self).__init__(hconcat=hconcat, bounds=bounds, center=center, data=data, - description=description, name=name, resolve=resolve, - spacing=spacing, title=title, transform=transform, **kwds) - + def __init__(self, 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): + super(LegendConfig, self).__init__(cornerRadius=cornerRadius, entryPadding=entryPadding, + fillColor=fillColor, gradientHeight=gradientHeight, + gradientLabelBaseline=gradientLabelBaseline, + gradientLabelLimit=gradientLabelLimit, + gradientLabelOffset=gradientLabelOffset, + gradientStrokeColor=gradientStrokeColor, + gradientStrokeWidth=gradientStrokeWidth, + gradientWidth=gradientWidth, labelAlign=labelAlign, + labelBaseline=labelBaseline, labelColor=labelColor, + labelFont=labelFont, labelFontSize=labelFontSize, + labelLimit=labelLimit, labelOffset=labelOffset, + offset=offset, orient=orient, padding=padding, + shortTimeLabels=shortTimeLabels, strokeColor=strokeColor, + strokeDash=strokeDash, strokeWidth=strokeWidth, + symbolColor=symbolColor, symbolSize=symbolSize, + symbolStrokeWidth=symbolStrokeWidth, symbolType=symbolType, + titleAlign=titleAlign, titleBaseline=titleBaseline, + titleColor=titleColor, titleFont=titleFont, + titleFontSize=titleFontSize, titleFontWeight=titleFontWeight, + titleLimit=titleLimit, titlePadding=titlePadding, **kwds) -class RepeatSpec(VegaLiteSchema): - """RepeatSpec schema wrapper - Mapping(required=[repeat, spec]) +class LegendOrient(VegaLiteSchema): + """LegendOrient schema wrapper - Attributes - ---------- + enum('left', 'right', 'top-left', 'top-right', 'bottom-left', 'bottom-right', 'none') + """ + _schema = {'$ref': '#/definitions/LegendOrient'} + _rootschema = Root._schema - repeat : :class:`Repeat` - An object that describes what fields should be repeated into views that are laid out - as a ``row`` or ``column``. - spec : :class:`Spec` + def __init__(self, *args): + super(LegendOrient, self).__init__(*args) - align : anyOf(:class:`VgLayoutAlign`, :class:`RowColVgLayoutAlign`) - The alignment to apply to grid rows and columns. - The supported string values are ``"all"``, ``"each"``, and ``"none"``. +class LegendResolveMap(VegaLiteSchema): + """LegendResolveMap schema wrapper - * 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. + Mapping(required=[]) - Alternatively, an object value of the form ``{"row": string, "column": string}`` can - be used to supply different alignments for rows and columns. + Attributes + ---------- - **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) or ``flush``. + color : :class:`ResolveMode` + fill : :class:`ResolveMode` - * If set to ``full``, the entire calculated bounds (including axes, title, and - legend) will be used. - * If set to ``flush``, 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. + opacity : :class:`ResolveMode` - **Default value:** ``"full"`` - center : anyOf(boolean, :class:`RowColboolean`) - Boolean flag indicating if subviews should be centered relative to their respective - rows or columns. + shape : :class:`ResolveMode` - An object value of the form ``{"row": boolean, "column": boolean}`` can be used to - supply different centering values for rows and columns. + size : :class:`ResolveMode` - **Default value:** ``false`` - data : :class:`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 : :class:`Resolve` - Scale and legend resolutions for repeated charts. - spacing : anyOf(float, :class:`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. + stroke : :class:`ResolveMode` - **Default value** : ``10`` - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`Transform`) - An array of data transformations such as filter and new field calculation. """ - _schema = {'$ref': '#/definitions/RepeatSpec'} + _schema = {'$ref': '#/definitions/LegendResolveMap'} _rootschema = Root._schema - def __init__(self, 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): - super(RepeatSpec, self).__init__(repeat=repeat, spec=spec, align=align, bounds=bounds, - center=center, data=data, description=description, name=name, - resolve=resolve, spacing=spacing, title=title, - transform=transform, **kwds) + def __init__(self, color=Undefined, fill=Undefined, opacity=Undefined, shape=Undefined, + size=Undefined, stroke=Undefined, **kwds): + super(LegendResolveMap, self).__init__(color=color, fill=fill, opacity=opacity, shape=shape, + size=size, stroke=stroke, **kwds) -class Spec(VegaLiteSchema): - """Spec schema wrapper +class LineConfig(VegaLiteSchema): + """LineConfig schema wrapper - anyOf(:class:`CompositeUnitSpec`, :class:`LayerSpec`, :class:`FacetSpec`, - :class:`RepeatSpec`, :class:`VConcatSpec`, :class:`HConcatSpec`) - """ - _schema = {'$ref': '#/definitions/Spec'} - _rootschema = Root._schema + Mapping(required=[]) - def __init__(self, *args, **kwds): - super(Spec, self).__init__(*args, **kwds) + Attributes + ---------- + align : :class:`HorizontalAlign` + The horizontal alignment of the text. One of ``"left"``, ``"right"``, ``"center"``. + angle : float + The rotation angle of the text, in degrees. + baseline : :class:`VerticalAlign` + The vertical alignment of the text. One of ``"top"``, ``"middle"``, ``"bottom"``. -class CompositeUnitSpecAlias(VegaLiteSchema): - """CompositeUnitSpecAlias schema wrapper + **Default value:** ``"middle"`` + color : string + Default color. Note that ``fill`` and ``stroke`` have higher precedence than + ``color`` and will override ``color``. - Mapping(required=[mark]) + **Default value:** :raw-html:`` + ``"#4682b4"`` - Attributes - ---------- + **Note:** This property cannot be used in a `style config + `__. + cornerRadius : float + The radius in pixels of rounded rectangle corners. - mark : :class:`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 : :class:`Data` - An object describing the data source - description : string - Description of this mark for commenting purpose. - encoding : :class:`Encoding` - A key-value mapping between encoding channels and definition of fields. - height : float - The height of a visualization. + **Default value:** ``0`` + cursor : :class:`Cursor` + The mouse cursor used over the mark. Any valid `CSS cursor type + `__ can be used. + dir : :class:`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:** + **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`` - * 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`` is ``null``, the height will be the value of `config.view.height - `__. - * If no field is mapped to ``y`` channel, the ``height`` will be the value of - ``rangeStep``. + **Default value:** (None) + fillOpacity : float + The fill opacity (value between [0,1]). - **Note** : For plots with `row and column channels - `__, this represents the - height of a single view. + **Default value:** ``1`` + filled : boolean + Whether the mark's color should be used as fill color instead of stroke color. - **See also:** The documentation for `width and height - `__ contains more examples. - name : string - Name of the visualization for later reference. - projection : :class:`Projection` - An object defining properties of geographic projection, which will be applied to - ``shape`` path for ``"geoshape"`` marks - and to ``latitude`` and ``"longitude"`` channels for other marks. - selection : Mapping(required=[]) - A key-value mapping between selection names and definitions. - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`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`` is ``null``, the width will be the value of `config.view.width - `__. - * If no field is mapped to ``x`` channel, the ``width`` will be the value of - `config.scale.textXRangeStep - `__ for - ``text`` mark and the value of ``rangeStep`` 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. - """ - _schema = {'$ref': '#/definitions/CompositeUnitSpecAlias'} - _rootschema = Root._schema - - def __init__(self, mark=Undefined, data=Undefined, description=Undefined, encoding=Undefined, - height=Undefined, name=Undefined, projection=Undefined, selection=Undefined, - title=Undefined, transform=Undefined, width=Undefined, **kwds): - super(CompositeUnitSpecAlias, self).__init__(mark=mark, data=data, description=description, - encoding=encoding, height=height, name=name, - projection=projection, selection=selection, - title=title, transform=transform, width=width, - **kwds) - - -class FacetedCompositeUnitSpecAlias(VegaLiteSchema): - """FacetedCompositeUnitSpecAlias schema wrapper - - Mapping(required=[mark]) - - Attributes - ---------- - - mark : :class:`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 : :class:`Data` - An object describing the data source - description : string - Description of this mark for commenting purpose. - encoding : :class:`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`` is ``null``, the height will be the value of `config.view.height - `__. - * If no field is mapped to ``y`` channel, the ``height`` will be the value of - ``rangeStep``. - - **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. - name : string - Name of the visualization for later reference. - projection : :class:`Projection` - An object defining properties of geographic projection, which will be applied to - ``shape`` path for ``"geoshape"`` marks - and to ``latitude`` and ``"longitude"`` channels for other marks. - selection : Mapping(required=[]) - A key-value mapping between selection names and definitions. - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`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`` is ``null``, the width will be the value of `config.view.width - `__. - * If no field is mapped to ``x`` channel, the ``width`` will be the value of - `config.scale.textXRangeStep - `__ for - ``text`` mark and the value of ``rangeStep`` 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. - """ - _schema = {'$ref': '#/definitions/FacetedCompositeUnitSpecAlias'} - _rootschema = Root._schema - - def __init__(self, mark=Undefined, data=Undefined, description=Undefined, encoding=Undefined, - height=Undefined, name=Undefined, projection=Undefined, selection=Undefined, - title=Undefined, transform=Undefined, width=Undefined, **kwds): - super(FacetedCompositeUnitSpecAlias, self).__init__(mark=mark, data=data, - description=description, encoding=encoding, - height=height, name=name, - projection=projection, selection=selection, - title=title, transform=transform, - width=width, **kwds) - - -class VConcatSpec(VegaLiteSchema): - """VConcatSpec schema wrapper - - Mapping(required=[vconcat]) - - Attributes - ---------- - - vconcat : List(:class:`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) or ``flush``. - - - * If set to ``full``, the entire calculated bounds (including axes, title, and - legend) will be used. - * If set to ``flush``, 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 : :class:`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 : :class:`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, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`Transform`) - An array of data transformations such as filter and new field calculation. - """ - _schema = {'$ref': '#/definitions/VConcatSpec'} - _rootschema = Root._schema - - def __init__(self, vconcat=Undefined, bounds=Undefined, center=Undefined, data=Undefined, - description=Undefined, name=Undefined, resolve=Undefined, spacing=Undefined, - title=Undefined, transform=Undefined, **kwds): - super(VConcatSpec, self).__init__(vconcat=vconcat, bounds=bounds, center=center, data=data, - description=description, name=name, resolve=resolve, - spacing=spacing, title=title, transform=transform, **kwds) - - -class GeoType(VegaLiteSchema): - """GeoType schema wrapper - - enum('latitude', 'longitude', 'geojson') - """ - _schema = {'$ref': '#/definitions/GeoType'} - _rootschema = Root._schema - - def __init__(self, *args): - super(GeoType, self).__init__(*args) - - -class Header(VegaLiteSchema): - """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`` and ``timeUnit`` ). 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 legend ``title`` 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 - `__ 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"``. - titleAngle : float - The rotation angle of the header title. + **Default value:** ``true`` for all marks except ``point`` and ``false`` for + ``point``. - **Default value:** ``0``. - titleBaseline : :class:`TextBaseline` - Vertical text baseline for the header title. One of ``"top"``, ``"bottom"``, - ``"middle"``. + **Applicable for:** ``bar``, ``point``, ``circle``, ``square``, and ``area`` marks. - **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 : :class:`FontWeight` - Font weight of the header title. + **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 : :class:`FontStyle` + The font style (e.g., ``"italic"`` ). + fontWeight : :class:`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`` ). - 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 - """ - _schema = {'$ref': '#/definitions/Header'} - _rootschema = Root._schema - - def __init__(self, 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): - super(Header, self).__init__(format=format, labelAngle=labelAngle, labelColor=labelColor, - labelFont=labelFont, labelFontSize=labelFontSize, - labelLimit=labelLimit, title=title, titleAnchor=titleAnchor, - titleAngle=titleAngle, titleBaseline=titleBaseline, - titleColor=titleColor, titleFont=titleFont, - titleFontSize=titleFontSize, titleFontWeight=titleFontWeight, - titleLimit=titleLimit, **kwds) - - -class HeaderConfig(VegaLiteSchema): - """HeaderConfig schema wrapper - - Mapping(required=[]) - - Attributes - ---------- + href : string + A URL to load upon mouse click. If defined, the mark acts as a hyperlink. + interpolate : :class:`Interpolate` + The line interpolation method to use for line and area marks. One of the following: - 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. + * ``"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 - 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 - `__ and `layered - `__ views. - ``"start"`` for other composite views. + opacity : float + The overall opacity (value between [0,1]). - **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.7`` for non-aggregate plots with ``point``, ``tick``, + ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. + orient : :class:`Orient` + The orientation of a non-stacked bar, tick, area, and line charts. + The value is either horizontal (default) or vertical. - **Default value:** ``0``. - titleBaseline : :class:`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 : :class:`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. + * 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, :class:`OverlayMarkDef`, enum('transparent')) + A flag for overlaying points on top of line or area marks, or an object defining the + properties of the overlayed points. - **Default value:** ``0``, indicating no limit - """ - _schema = {'$ref': '#/definitions/HeaderConfig'} - _rootschema = Root._schema - def __init__(self, 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): - super(HeaderConfig, self).__init__(labelAngle=labelAngle, labelColor=labelColor, - labelFont=labelFont, labelFontSize=labelFontSize, - labelLimit=labelLimit, titleAnchor=titleAnchor, - titleAngle=titleAngle, titleBaseline=titleBaseline, - titleColor=titleColor, titleFont=titleFont, - titleFontSize=titleFontSize, titleFontWeight=titleFontWeight, - titleLimit=titleLimit, **kwds) + If this property is ``"transparent"``, transparent points will be used (for + enhancing tooltips and selections). + If this property is an empty object ( ``{}`` ) or ``true``, filled points with + default properties will be used. -class HorizontalAlign(VegaLiteSchema): - """HorizontalAlign schema wrapper + If this property is ``false``, no points would be automatically added to line or + area marks. - enum('left', 'right', 'center') - """ - _schema = {'$ref': '#/definitions/HorizontalAlign'} - _rootschema = Root._schema + **Default value:** ``false``. + radius : float + Polar coordinate radial offset, in pixels, of the text label from the origin + determined by the ``x`` and ``y`` 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. - def __init__(self, *args): - super(HorizontalAlign, self).__init__(*args) + **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`` -class InlineData(VegaLiteSchema): - """InlineData schema wrapper + **Default value:** (None) + strokeCap : :class:`StrokeCap` + The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or + ``"square"``. - Mapping(required=[values]) + **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 : :class:`StrokeJoin` + The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. - Attributes - ---------- + **Default value:** ``"miter"`` + strokeMiterLimit : float + The miter limit at which to bevel a line join. + strokeOpacity : float + The stroke opacity (value between [0,1]). - values : :class:`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 : :class:`DataFormat` - An object that specifies the format for parsing the data. - name : string - Provide a placeholder name and bind data at runtime. + **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`` and ``y`` properties. Values for ``theta`` follow the same convention of + ``arc`` mark ``startAngle`` and ``endAngle`` properties: angles are measured in + radians, with ``0`` indicating "north". + tooltip : Mapping(required=[]) + The tooltip text to show upon mouse hover. """ - _schema = {'$ref': '#/definitions/InlineData'} + _schema = {'$ref': '#/definitions/LineConfig'} _rootschema = Root._schema - def __init__(self, values=Undefined, format=Undefined, name=Undefined, **kwds): - super(InlineData, self).__init__(values=values, format=format, name=name, **kwds) + def __init__(self, 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): + super(LineConfig, self).__init__(align=align, angle=angle, baseline=baseline, color=color, + cornerRadius=cornerRadius, cursor=cursor, dir=dir, dx=dx, + dy=dy, ellipsis=ellipsis, fill=fill, fillOpacity=fillOpacity, + filled=filled, font=font, fontSize=fontSize, + fontStyle=fontStyle, fontWeight=fontWeight, href=href, + interpolate=interpolate, limit=limit, opacity=opacity, + orient=orient, point=point, radius=radius, shape=shape, + size=size, stroke=stroke, strokeCap=strokeCap, + strokeDash=strokeDash, strokeDashOffset=strokeDashOffset, + strokeJoin=strokeJoin, strokeMiterLimit=strokeMiterLimit, + strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, + tension=tension, text=text, theta=theta, tooltip=tooltip, + **kwds) -class InlineDataset(VegaLiteSchema): - """InlineDataset schema wrapper +class LogicalOperandPredicate(VegaLiteSchema): + """LogicalOperandPredicate schema wrapper - anyOf(List(float), List(string), List(boolean), List(Mapping(required=[])), string, - Mapping(required=[])) + anyOf(:class:`LogicalNotPredicate`, :class:`LogicalAndPredicate`, + :class:`LogicalOrPredicate`, :class:`Predicate`) """ - _schema = {'$ref': '#/definitions/InlineDataset'} + _schema = {'$ref': '#/definitions/LogicalOperand'} _rootschema = Root._schema def __init__(self, *args, **kwds): - super(InlineDataset, self).__init__(*args, **kwds) - - -class Interpolate(VegaLiteSchema): - """Interpolate schema wrapper - - enum('linear', 'linear-closed', 'step', 'step-before', 'step-after', 'basis', 'basis-open', - 'basis-closed', 'cardinal', 'cardinal-open', 'cardinal-closed', 'bundle', 'monotone') - """ - _schema = {'$ref': '#/definitions/Interpolate'} - _rootschema = Root._schema - - def __init__(self, *args): - super(Interpolate, self).__init__(*args) + super(LogicalOperandPredicate, self).__init__(*args, **kwds) -class IntervalSelection(VegaLiteSchema): - """IntervalSelection schema wrapper +class LogicalAndPredicate(LogicalOperandPredicate): + """LogicalAndPredicate schema wrapper - Mapping(required=[type]) + Mapping(required=[and]) 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(:class:`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 : :class:`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 : :class:`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 : :class:`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, - only ``wheel`` events are supported. + and : List(:class:`LogicalOperandPredicate`) - **Default value:** ``true``, which corresponds to ``wheel!``. """ - _schema = {'$ref': '#/definitions/IntervalSelection'} + _schema = {'$ref': '#/definitions/LogicalAnd'} _rootschema = Root._schema - def __init__(self, type=Undefined, bind=Undefined, empty=Undefined, encodings=Undefined, - fields=Undefined, mark=Undefined, on=Undefined, resolve=Undefined, translate=Undefined, - zoom=Undefined, **kwds): - super(IntervalSelection, self).__init__(type=type, bind=bind, empty=empty, encodings=encodings, - fields=fields, mark=mark, on=on, resolve=resolve, - translate=translate, zoom=zoom, **kwds) + def __init__(self, **kwds): + super(LogicalAndPredicate, self).__init__(**kwds) -class IntervalSelectionConfig(VegaLiteSchema): - """IntervalSelectionConfig schema wrapper +class LogicalNotPredicate(LogicalOperandPredicate): + """LogicalNotPredicate schema wrapper - Mapping(required=[]) + Mapping(required=[not]) 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(:class:`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 : :class:`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 : :class:`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 : :class:`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, - only ``wheel`` events are supported. + not : :class:`LogicalOperandPredicate` - **Default value:** ``true``, which corresponds to ``wheel!``. """ - _schema = {'$ref': '#/definitions/IntervalSelectionConfig'} + _schema = {'$ref': '#/definitions/LogicalNot'} _rootschema = Root._schema - def __init__(self, bind=Undefined, empty=Undefined, encodings=Undefined, fields=Undefined, - mark=Undefined, on=Undefined, resolve=Undefined, translate=Undefined, zoom=Undefined, - **kwds): - super(IntervalSelectionConfig, self).__init__(bind=bind, empty=empty, encodings=encodings, - fields=fields, mark=mark, on=on, resolve=resolve, - translate=translate, zoom=zoom, **kwds) + def __init__(self, **kwds): + super(LogicalNotPredicate, self).__init__(**kwds) -class JsonDataFormat(VegaLiteSchema): - """JsonDataFormat schema wrapper +class LogicalOrPredicate(LogicalOperandPredicate): + """LogicalOrPredicate schema wrapper - Mapping(required=[]) + Mapping(required=[or]) Attributes ---------- - parse : anyOf(enum('auto'), :class:`Parse`, None) - If set to ``"auto"`` (the default), perform automatic type inference to determine - the desired data types. - If set to ``null``, 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 the ``modified_on`` field - in each input record a Date value. + or : List(:class:`LogicalOperandPredicate`) - 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 retrieving - ``json.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. """ - _schema = {'$ref': '#/definitions/JsonDataFormat'} + _schema = {'$ref': '#/definitions/LogicalOr'} _rootschema = Root._schema - def __init__(self, parse=Undefined, property=Undefined, type=Undefined, **kwds): - super(JsonDataFormat, self).__init__(parse=parse, property=property, type=type, **kwds) + def __init__(self, **kwds): + super(LogicalOrPredicate, self).__init__(**kwds) -class Legend(VegaLiteSchema): - """Legend schema wrapper +class LookupData(VegaLiteSchema): + """LookupData schema wrapper - Mapping(required=[]) - Properties of a legend or boolean flag for determining whether to show it. + Mapping(required=[data, key]) 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 : :class:`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`` and ``timeUnit`` ). 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** : + data : :class:`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. + """ + _schema = {'$ref': '#/definitions/LookupData'} + _rootschema = Root._schema - 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 - `__. + def __init__(self, data=Undefined, key=Undefined, fields=Undefined, **kwds): + super(LookupData, self).__init__(data=data, key=key, fields=fields, **kwds) - 2) If both field definition's ``title`` and axis, header, or legend ``title`` 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 - ``"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(:class:`DateTime`)) - 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 Mark(AnyMark): + """Mark schema wrapper + + enum('area', 'bar', 'line', 'trail', 'point', 'text', 'tick', 'rect', 'rule', 'circle', + 'square', 'geoshape') + All types of primitive marks. """ - _schema = {'$ref': '#/definitions/Legend'} + _schema = {'$ref': '#/definitions/Mark'} _rootschema = Root._schema - def __init__(self, entryPadding=Undefined, format=Undefined, offset=Undefined, orient=Undefined, - padding=Undefined, tickCount=Undefined, title=Undefined, type=Undefined, - values=Undefined, zindex=Undefined, **kwds): - super(Legend, self).__init__(entryPadding=entryPadding, format=format, offset=offset, - orient=orient, padding=padding, tickCount=tickCount, title=title, - type=type, values=values, zindex=zindex, **kwds) + def __init__(self, *args): + super(Mark, self).__init__(*args) -class LegendConfig(VegaLiteSchema): - """LegendConfig schema wrapper +class MarkConfig(VegaLiteSchema): + """MarkConfig schema wrapper Mapping(required=[]) Attributes ---------- + align : :class:`HorizontalAlign` + The horizontal alignment of the text. One of ``"left"``, ``"right"``, ``"center"``. + angle : float + The rotation angle of the text, in degrees. + baseline : :class:`VerticalAlign` + The vertical alignment of the text. One of ``"top"``, ``"middle"``, ``"bottom"``. + + **Default value:** ``"middle"`` + color : string + Default color. Note that ``fill`` and ``stroke`` have higher precedence than + ``color`` and will override ``color``. + + **Default value:** :raw-html:`` + ``"#4682b4"`` + + **Note:** This property cannot be used in a `style config + `__. 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. + The radius in pixels of rounded rectangle corners. - **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`` + cursor : :class:`Cursor` + The mouse cursor used over the mark. Any valid `CSS cursor type + `__ can be used. + dir : :class:`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:** ``0`` - orient : :class:`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:** ``"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:** ``"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:** ``"…"`` + fill : string + Default Fill Color. This has higher precedence than ``config.color`` - **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 : :class:`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. - """ - _schema = {'$ref': '#/definitions/LegendConfig'} - _rootschema = Root._schema + **Default value:** (None) + fillOpacity : float + The fill opacity (value between [0,1]). - def __init__(self, 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): - super(LegendConfig, self).__init__(cornerRadius=cornerRadius, entryPadding=entryPadding, - fillColor=fillColor, gradientHeight=gradientHeight, - gradientLabelBaseline=gradientLabelBaseline, - gradientLabelLimit=gradientLabelLimit, - gradientLabelOffset=gradientLabelOffset, - gradientStrokeColor=gradientStrokeColor, - gradientStrokeWidth=gradientStrokeWidth, - gradientWidth=gradientWidth, labelAlign=labelAlign, - labelBaseline=labelBaseline, labelColor=labelColor, - labelFont=labelFont, labelFontSize=labelFontSize, - labelLimit=labelLimit, labelOffset=labelOffset, - offset=offset, orient=orient, padding=padding, - shortTimeLabels=shortTimeLabels, strokeColor=strokeColor, - strokeDash=strokeDash, strokeWidth=strokeWidth, - symbolColor=symbolColor, symbolSize=symbolSize, - symbolStrokeWidth=symbolStrokeWidth, symbolType=symbolType, - titleAlign=titleAlign, titleBaseline=titleBaseline, - titleColor=titleColor, titleFont=titleFont, - titleFontSize=titleFontSize, titleFontWeight=titleFontWeight, - titleLimit=titleLimit, titlePadding=titlePadding, **kwds) + **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 except ``point`` and ``false`` for + ``point``. -class LegendOrient(VegaLiteSchema): - """LegendOrient schema wrapper + **Applicable for:** ``bar``, ``point``, ``circle``, ``square``, and ``area`` marks. - enum('left', 'right', 'top-left', 'top-right', 'bottom-left', 'bottom-right', 'none') - """ - _schema = {'$ref': '#/definitions/LegendOrient'} - _rootschema = Root._schema + **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 : :class:`FontStyle` + The font style (e.g., ``"italic"`` ). + fontWeight : :class:`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 : :class:`Interpolate` + The line interpolation method to use for line and area marks. One of the following: - def __init__(self, *args): - super(LegendOrient, self).__init__(*args) + * ``"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. -class LegendResolveMap(VegaLiteSchema): - """LegendResolveMap schema wrapper + **Default value:** ``0``, indicating no limit + opacity : float + The overall opacity (value between [0,1]). - Mapping(required=[]) + **Default value:** ``0.7`` for non-aggregate plots with ``point``, ``tick``, + ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. + orient : :class:`Orient` + The orientation of a non-stacked bar, tick, area, and line charts. + The value is either horizontal (default) or vertical. - Attributes - ---------- - color : :class:`ResolveMode` + * 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`` and ``y`` 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. - fill : :class:`ResolveMode` + **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. - opacity : :class:`ResolveMode` + **Default value:** ``30`` + stroke : string + Default Stroke Color. This has higher precedence than ``config.color`` - shape : :class:`ResolveMode` + **Default value:** (None) + strokeCap : :class:`StrokeCap` + The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or + ``"square"``. - size : :class:`ResolveMode` + **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 : :class:`StrokeJoin` + The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. - stroke : :class:`ResolveMode` + **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`` and ``y`` properties. Values for ``theta`` follow the same convention of + ``arc`` mark ``startAngle`` and ``endAngle`` properties: angles are measured in + radians, with ``0`` indicating "north". + tooltip : Mapping(required=[]) + The tooltip text to show upon mouse hover. """ - _schema = {'$ref': '#/definitions/LegendResolveMap'} + _schema = {'$ref': '#/definitions/MarkConfig'} _rootschema = Root._schema - def __init__(self, color=Undefined, fill=Undefined, opacity=Undefined, shape=Undefined, - size=Undefined, stroke=Undefined, **kwds): - super(LegendResolveMap, self).__init__(color=color, fill=fill, opacity=opacity, shape=shape, - size=size, stroke=stroke, **kwds) + def __init__(self, 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): + super(MarkConfig, self).__init__(align=align, angle=angle, baseline=baseline, color=color, + cornerRadius=cornerRadius, cursor=cursor, dir=dir, dx=dx, + dy=dy, ellipsis=ellipsis, fill=fill, fillOpacity=fillOpacity, + filled=filled, font=font, fontSize=fontSize, + fontStyle=fontStyle, fontWeight=fontWeight, href=href, + interpolate=interpolate, limit=limit, opacity=opacity, + orient=orient, radius=radius, shape=shape, size=size, + stroke=stroke, strokeCap=strokeCap, strokeDash=strokeDash, + strokeDashOffset=strokeDashOffset, strokeJoin=strokeJoin, + strokeMiterLimit=strokeMiterLimit, strokeOpacity=strokeOpacity, + strokeWidth=strokeWidth, tension=tension, text=text, + theta=theta, tooltip=tooltip, **kwds) -class LineConfig(VegaLiteSchema): - """LineConfig schema wrapper +class MarkDef(AnyMark): + """MarkDef schema wrapper - Mapping(required=[]) + Mapping(required=[type]) Attributes ---------- + type : :class:`Mark` + The mark type. + One of ``"bar"``, ``"circle"``, ``"square"``, ``"tick"``, ``"line"``, + ``"area"``, ``"point"``, ``"geoshape"``, ``"rule"``, and ``"text"``. align : :class:`HorizontalAlign` The horizontal alignment of the text. One of ``"left"``, ``"right"``, ``"center"``. angle : float @@ -4689,6 +4126,13 @@ class LineConfig(VegaLiteSchema): 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`` and ``stroke`` have higher precedence than ``color`` and will override ``color``. @@ -4779,6 +4223,17 @@ class LineConfig(VegaLiteSchema): truncated if the rendered size exceeds the limit. **Default value:** ``0``, indicating no limit + line : anyOf(boolean, :class:`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 ( ``{}`` ) or ``true``, 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]). @@ -4852,6 +4307,20 @@ class LineConfig(VegaLiteSchema): **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 from ``config.style.bar`` and + ``config.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). @@ -4862,479 +4331,396 @@ class LineConfig(VegaLiteSchema): the ``x`` and ``y`` properties. Values for ``theta`` follow the same convention of ``arc`` mark ``startAngle`` and ``endAngle`` properties: angles are measured in radians, with ``0`` indicating "north". + thickness : float + Thickness of the tick mark. + + **Default value:** ``1`` 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. """ - _schema = {'$ref': '#/definitions/LineConfig'} + _schema = {'$ref': '#/definitions/MarkDef'} _rootschema = Root._schema - def __init__(self, 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, + def __init__(self, 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, tension=Undefined, text=Undefined, - theta=Undefined, tooltip=Undefined, **kwds): - super(LineConfig, self).__init__(align=align, angle=angle, baseline=baseline, color=color, - cornerRadius=cornerRadius, cursor=cursor, dir=dir, dx=dx, - dy=dy, ellipsis=ellipsis, fill=fill, fillOpacity=fillOpacity, - filled=filled, font=font, fontSize=fontSize, - fontStyle=fontStyle, fontWeight=fontWeight, href=href, - interpolate=interpolate, limit=limit, opacity=opacity, - orient=orient, point=point, radius=radius, shape=shape, - size=size, stroke=stroke, strokeCap=strokeCap, - strokeDash=strokeDash, strokeDashOffset=strokeDashOffset, - strokeJoin=strokeJoin, strokeMiterLimit=strokeMiterLimit, - strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, - tension=tension, text=text, theta=theta, tooltip=tooltip, - **kwds) - - -class LocalMultiTimeUnit(VegaLiteSchema): - """LocalMultiTimeUnit schema wrapper - - enum('yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', - 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'quartermonth', - 'monthdate', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds') - """ - _schema = {'$ref': '#/definitions/LocalMultiTimeUnit'} - _rootschema = Root._schema - - def __init__(self, *args): - super(LocalMultiTimeUnit, self).__init__(*args) - - -class LocalSingleTimeUnit(VegaLiteSchema): - """LocalSingleTimeUnit schema wrapper - - enum('year', 'quarter', 'month', 'day', 'date', 'hours', 'minutes', 'seconds', - 'milliseconds') - """ - _schema = {'$ref': '#/definitions/LocalSingleTimeUnit'} - _rootschema = Root._schema - - def __init__(self, *args): - super(LocalSingleTimeUnit, self).__init__(*args) - - -class LogicalAndPredicate(VegaLiteSchema): - """LogicalAndPredicate schema wrapper - - Mapping(required=[and]) - - Attributes - ---------- - - and : List(:class:`LogicalOperandPredicate`) - - """ - _schema = {'$ref': '#/definitions/LogicalAnd'} - _rootschema = Root._schema - - def __init__(self, **kwds): - super(LogicalAndPredicate, self).__init__(**kwds) - - -class SelectionAnd(VegaLiteSchema): - """SelectionAnd schema wrapper - - Mapping(required=[and]) - - Attributes - ---------- - - and : List(:class:`SelectionOperand`) - - """ - _schema = {'$ref': '#/definitions/SelectionAnd'} - _rootschema = Root._schema - - def __init__(self, **kwds): - super(SelectionAnd, self).__init__(**kwds) - - -class LogicalNotPredicate(VegaLiteSchema): - """LogicalNotPredicate schema wrapper - - Mapping(required=[not]) - - Attributes - ---------- - - not : :class:`LogicalOperandPredicate` - - """ - _schema = {'$ref': '#/definitions/LogicalNot'} - _rootschema = Root._schema - - def __init__(self, **kwds): - super(LogicalNotPredicate, self).__init__(**kwds) + 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): + super(MarkDef, self).__init__(type=type, align=align, angle=angle, baseline=baseline, + binSpacing=binSpacing, clip=clip, color=color, + cornerRadius=cornerRadius, cursor=cursor, dir=dir, dx=dx, dy=dy, + ellipsis=ellipsis, fill=fill, fillOpacity=fillOpacity, + filled=filled, font=font, fontSize=fontSize, fontStyle=fontStyle, + fontWeight=fontWeight, href=href, interpolate=interpolate, + limit=limit, line=line, opacity=opacity, orient=orient, + point=point, radius=radius, shape=shape, size=size, stroke=stroke, + strokeCap=strokeCap, strokeDash=strokeDash, + strokeDashOffset=strokeDashOffset, strokeJoin=strokeJoin, + strokeMiterLimit=strokeMiterLimit, strokeOpacity=strokeOpacity, + strokeWidth=strokeWidth, style=style, tension=tension, text=text, + theta=theta, thickness=thickness, tooltip=tooltip, + x2Offset=x2Offset, xOffset=xOffset, y2Offset=y2Offset, + yOffset=yOffset, **kwds) -class SelectionNot(VegaLiteSchema): - """SelectionNot schema wrapper +class MarkPropFieldDefWithCondition(VegaLiteSchema): + """MarkPropFieldDefWithCondition schema wrapper - Mapping(required=[not]) + Mapping(required=[type]) + A FieldDef with Condition :raw-html:`` Attributes ---------- - not : :class:`SelectionOperand` + type : :class:`Type` + The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, + ``"ordinal"``, or ``"nominal"`` ). + It can also be a ``"geojson"`` type for encoding `'geoshape' + `__. + aggregate : :class:`Aggregate` + Aggregation function for the field + (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). - """ - _schema = {'$ref': '#/definitions/SelectionNot'} - _rootschema = Root._schema + **Default value:** ``undefined`` (None) + bin : anyOf(boolean, :class:`BinParams`) + A flag for binning a ``quantitative`` field, or `an object defining binning + parameters `__. + If ``true``, default `binning parameters + `__ will be applied. - def __init__(self, **kwds): - super(SelectionNot, self).__init__(**kwds) + **Default value:** ``false`` + condition : anyOf(:class:`ConditionalValueDef`, List(:class:`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, :class:`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. -class LogicalOperandPredicate(VegaLiteSchema): - """LogicalOperandPredicate schema wrapper + **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 + `__. - anyOf(:class:`LogicalNotPredicate`, :class:`LogicalAndPredicate`, - :class:`LogicalOrPredicate`, :class:`Predicate`) - """ - _schema = {'$ref': '#/definitions/LogicalOperand'} - _rootschema = Root._schema + **Note:** ``field`` is not required if ``aggregate`` is ``count``. + legend : anyOf(:class:`Legend`, None) + An object defining properties of the legend. + If ``null``, the legend for the encoding channel will be removed. - def __init__(self, *args, **kwds): - super(LogicalOperandPredicate, self).__init__(*args, **kwds) + **Default value:** If undefined, default `legend properties + `__ are applied. + scale : anyOf(:class:`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 + `__. -class SelectionOperand(VegaLiteSchema): - """SelectionOperand schema wrapper + **Default value:** If undefined, default `scale properties + `__ are applied. + sort : :class:`Sort` + Sort order for the encoded field. - anyOf(:class:`SelectionNot`, :class:`SelectionAnd`, :class:`SelectionOr`, string) - """ - _schema = {'$ref': '#/definitions/SelectionOperand'} - _rootschema = Root._schema + For continuous fields (quantitative or temporal), ``sort`` can be either + ``"ascending"`` or ``"descending"``. - def __init__(self, *args, **kwds): - super(SelectionOperand, self).__init__(*args, **kwds) + For discrete fields, ``sort`` can be one of the following: -class LogicalOrPredicate(VegaLiteSchema): - """LogicalOrPredicate schema wrapper + * ``"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. - Mapping(required=[or]) + **Default value:** ``"ascending"`` - Attributes - ---------- + **Note:** ``null`` is not supported for ``row`` and ``column``. + timeUnit : :class:`TimeUnit` + Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal + field. + or `a temporal field that gets casted as ordinal + `__. - or : List(:class:`LogicalOperandPredicate`) + **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`` and ``timeUnit`` ). 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 legend ``title`` are + defined, axis/header/legend title will be used. """ - _schema = {'$ref': '#/definitions/LogicalOr'} + _schema = {'$ref': '#/definitions/MarkPropFieldDefWithCondition'} _rootschema = Root._schema - def __init__(self, **kwds): - super(LogicalOrPredicate, self).__init__(**kwds) + def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, + field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, + title=Undefined, **kwds): + super(MarkPropFieldDefWithCondition, self).__init__(type=type, aggregate=aggregate, bin=bin, + condition=condition, field=field, + legend=legend, scale=scale, sort=sort, + timeUnit=timeUnit, title=title, **kwds) -class SelectionOr(VegaLiteSchema): - """SelectionOr schema wrapper +class MarkPropValueDefWithCondition(VegaLiteSchema): + """MarkPropValueDefWithCondition schema wrapper - Mapping(required=[or]) + Mapping(required=[]) + A ValueDef with Condition Attributes ---------- - or : List(:class:`SelectionOperand`) - + condition : anyOf(:class:`ConditionalMarkPropFieldDef`, :class:`ConditionalValueDef`, + List(:class:`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. """ - _schema = {'$ref': '#/definitions/SelectionOr'} + _schema = {'$ref': '#/definitions/MarkPropValueDefWithCondition'} _rootschema = Root._schema - def __init__(self, **kwds): - super(SelectionOr, self).__init__(**kwds) - - -class LookupData(VegaLiteSchema): - """LookupData schema wrapper + def __init__(self, condition=Undefined, value=Undefined, **kwds): + super(MarkPropValueDefWithCondition, self).__init__(condition=condition, value=value, **kwds) - Mapping(required=[data, key]) - Attributes - ---------- +class Month(VegaLiteSchema): + """Month schema wrapper - data : :class:`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. + float """ - _schema = {'$ref': '#/definitions/LookupData'} + _schema = {'$ref': '#/definitions/Month'} _rootschema = Root._schema - def __init__(self, data=Undefined, key=Undefined, fields=Undefined, **kwds): - super(LookupData, self).__init__(data=data, key=key, fields=fields, **kwds) + def __init__(self, *args): + super(Month, self).__init__(*args) -class LookupTransform(VegaLiteSchema): - """LookupTransform schema wrapper +class MultiSelectionConfig(VegaLiteSchema): + """MultiSelectionConfig schema wrapper - Mapping(required=[lookup, from]) + Mapping(required=[]) 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 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 : :class:`LookupData` - Secondary data reference. - """ - _schema = {'$ref': '#/definitions/LookupTransform'} - _rootschema = Root._schema - - def __init__(self, lookup=Undefined, default=Undefined, **kwds): - super(LookupTransform, self).__init__(lookup=lookup, default=default, **kwds) + 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(:class:`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 : :class:`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 : :class:`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 `__. -class Mark(VegaLiteSchema): - """Mark schema wrapper + **Default value:** ``true``, which corresponds to ``event.shiftKey`` (i.e., + data values are toggled when a user interacts with the shift-key pressed). - enum('area', 'bar', 'line', 'trail', 'point', 'text', 'tick', 'rect', 'rule', 'circle', - 'square', 'geoshape') - All types of primitive marks. + See the `toggle transform `__ + documentation for more information. """ - _schema = {'$ref': '#/definitions/Mark'} + _schema = {'$ref': '#/definitions/MultiSelectionConfig'} _rootschema = Root._schema - def __init__(self, *args): - super(Mark, self).__init__(*args) - - -class MarkConfig(VegaLiteSchema): - """MarkConfig schema wrapper - - Mapping(required=[]) - - Attributes - ---------- + def __init__(self, empty=Undefined, encodings=Undefined, fields=Undefined, nearest=Undefined, + on=Undefined, resolve=Undefined, toggle=Undefined, **kwds): + super(MultiSelectionConfig, self).__init__(empty=empty, encodings=encodings, fields=fields, + nearest=nearest, on=on, resolve=resolve, + toggle=toggle, **kwds) - align : :class:`HorizontalAlign` - The horizontal alignment of the text. One of ``"left"``, ``"right"``, ``"center"``. - angle : float - The rotation angle of the text, in degrees. - baseline : :class:`VerticalAlign` - The vertical alignment of the text. One of ``"top"``, ``"middle"``, ``"bottom"``. - **Default value:** ``"middle"`` - color : string - Default color. Note that ``fill`` and ``stroke`` have higher precedence than - ``color`` and will override ``color``. +class NamedData(Data): + """NamedData schema wrapper - **Default value:** :raw-html:`` - ``"#4682b4"`` + Mapping(required=[name]) - **Note:** This property cannot be used in a `style config - `__. - cornerRadius : float - The radius in pixels of rounded rectangle corners. + Attributes + ---------- - **Default value:** ``0`` - cursor : :class:`Cursor` - The mouse cursor used over the mark. Any valid `CSS cursor type - `__ can be used. - dir : :class:`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. + name : string + Provide a placeholder name and bind data at runtime. + format : :class:`DataFormat` + An object that specifies the format for parsing the data. + """ + _schema = {'$ref': '#/definitions/NamedData'} + _rootschema = Root._schema - **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. + def __init__(self, name=Undefined, format=Undefined, **kwds): + super(NamedData, self).__init__(name=name, format=format, **kwds) - **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]). +class NiceTime(VegaLiteSchema): + """NiceTime schema wrapper - **Default value:** ``1`` - filled : boolean - Whether the mark's color should be used as fill color instead of stroke color. + enum('second', 'minute', 'hour', 'day', 'week', 'month', 'year') + """ + _schema = {'$ref': '#/definitions/NiceTime'} + _rootschema = Root._schema - **Default value:** ``true`` for all marks except ``point`` and ``false`` for - ``point``. + def __init__(self, *args): + super(NiceTime, self).__init__(*args) - **Applicable for:** ``bar``, ``point``, ``circle``, ``square``, and ``area`` 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 : :class:`FontStyle` - The font style (e.g., ``"italic"`` ). - fontWeight : :class:`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 : :class:`Interpolate` - The line interpolation method to use for line and area marks. One of the following: +class OrderFieldDef(VegaLiteSchema): + """OrderFieldDef schema wrapper + Mapping(required=[type]) - * ``"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. + Attributes + ---------- - **Default value:** ``0``, indicating no limit - opacity : float - The overall opacity (value between [0,1]). + type : :class:`Type` + The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, + ``"ordinal"``, or ``"nominal"`` ). + It can also be a ``"geojson"`` type for encoding `'geoshape' + `__. + aggregate : :class:`Aggregate` + Aggregation function for the field + (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). - **Default value:** ``0.7`` for non-aggregate plots with ``point``, ``tick``, - ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. - orient : :class:`Orient` - The orientation of a non-stacked bar, tick, area, and line charts. - The value is either horizontal (default) or vertical. + **Default value:** ``undefined`` (None) + bin : anyOf(boolean, :class:`BinParams`) + A flag for binning a ``quantitative`` field, or `an object defining binning + parameters `__. + If ``true``, default `binning parameters + `__ will be applied. + **Default value:** ``false`` + field : anyOf(string, :class:`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. - * 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`` and ``y`` 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. + **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 + `__. - **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. + **Note:** ``field`` is not required if ``aggregate`` is ``count``. + sort : :class:`SortOrder` + The sort order. One of ``"ascending"`` (default) or ``"descending"``. + timeUnit : :class:`TimeUnit` + Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal + field. + or `a temporal field that gets casted as ordinal + `__. - **Default value:** ``30`` - stroke : string - Default Stroke Color. This has higher precedence than ``config.color`` + **Default value:** ``undefined`` (None) + title : anyOf(string, None) + A title for the field. If ``null``, the title will be removed. - **Default value:** (None) - strokeCap : :class:`StrokeCap` - The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or - ``"square"``. + **Default value:** derived from the field's name and transformation function ( + ``aggregate``, ``bin`` and ``timeUnit`` ). 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. - **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 : :class:`StrokeJoin` - The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. + **Notes** : - **Default value:** ``"miter"`` - strokeMiterLimit : float - The miter limit at which to bevel a line join. - strokeOpacity : float - The stroke opacity (value between [0,1]). + 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 + `__. - **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`` and ``y`` properties. Values for ``theta`` follow the same convention of - ``arc`` mark ``startAngle`` and ``endAngle`` properties: angles are measured in - radians, with ``0`` indicating "north". - tooltip : Mapping(required=[]) - The tooltip text to show upon mouse hover. + 2) If both field definition's ``title`` and axis, header, or legend ``title`` are + defined, axis/header/legend title will be used. """ - _schema = {'$ref': '#/definitions/MarkConfig'} + _schema = {'$ref': '#/definitions/OrderFieldDef'} _rootschema = Root._schema - def __init__(self, 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): - super(MarkConfig, self).__init__(align=align, angle=angle, baseline=baseline, color=color, - cornerRadius=cornerRadius, cursor=cursor, dir=dir, dx=dx, - dy=dy, ellipsis=ellipsis, fill=fill, fillOpacity=fillOpacity, - filled=filled, font=font, fontSize=fontSize, - fontStyle=fontStyle, fontWeight=fontWeight, href=href, - interpolate=interpolate, limit=limit, opacity=opacity, - orient=orient, radius=radius, shape=shape, size=size, - stroke=stroke, strokeCap=strokeCap, strokeDash=strokeDash, - strokeDashOffset=strokeDashOffset, strokeJoin=strokeJoin, - strokeMiterLimit=strokeMiterLimit, strokeOpacity=strokeOpacity, - strokeWidth=strokeWidth, tension=tension, text=text, - theta=theta, tooltip=tooltip, **kwds) + def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, + sort=Undefined, timeUnit=Undefined, title=Undefined, **kwds): + super(OrderFieldDef, self).__init__(type=type, aggregate=aggregate, bin=bin, field=field, + sort=sort, timeUnit=timeUnit, title=title, **kwds) + + +class Orient(VegaLiteSchema): + """Orient schema wrapper + enum('horizontal', 'vertical') + """ + _schema = {'$ref': '#/definitions/Orient'} + _rootschema = Root._schema -class MarkDef(VegaLiteSchema): - """MarkDef schema wrapper + def __init__(self, *args): + super(Orient, self).__init__(*args) - Mapping(required=[type]) + +class OverlayMarkDef(VegaLiteSchema): + """OverlayMarkDef schema wrapper + + Mapping(required=[]) Attributes ---------- - type : :class:`Mark` - The mark type. - One of ``"bar"``, ``"circle"``, ``"square"``, ``"tick"``, ``"line"``, - ``"area"``, ``"point"``, ``"geoshape"``, ``"rule"``, and ``"text"``. align : :class:`HorizontalAlign` The horizontal alignment of the text. One of ``"left"``, ``"right"``, ``"center"``. angle : float @@ -5343,11 +4729,6 @@ class MarkDef(VegaLiteSchema): 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 @@ -5440,17 +4821,6 @@ class MarkDef(VegaLiteSchema): truncated if the rendered size exceeds the limit. **Default value:** ``0``, indicating no limit - line : anyOf(boolean, :class:`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 ( ``{}`` ) or ``true``, 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]). @@ -5469,21 +4839,6 @@ class MarkDef(VegaLiteSchema): 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, :class:`OverlayMarkDef`, 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 ( ``{}`` ) or ``true``, 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`` and ``y`` properties. @@ -5521,1817 +4876,2126 @@ class MarkDef(VegaLiteSchema): 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:** ``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 from ``config.style.bar`` and + ``config.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`` and ``y`` properties. Values for ``theta`` follow the same convention of + ``arc`` mark ``startAngle`` and ``endAngle`` properties: angles are measured in + radians, with ``0`` 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. + """ + _schema = {'$ref': '#/definitions/OverlayMarkDef'} + _rootschema = Root._schema + + def __init__(self, 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): + super(OverlayMarkDef, self).__init__(align=align, angle=angle, baseline=baseline, clip=clip, + color=color, cornerRadius=cornerRadius, cursor=cursor, + dir=dir, dx=dx, dy=dy, ellipsis=ellipsis, fill=fill, + fillOpacity=fillOpacity, filled=filled, font=font, + fontSize=fontSize, fontStyle=fontStyle, + fontWeight=fontWeight, href=href, interpolate=interpolate, + limit=limit, opacity=opacity, orient=orient, radius=radius, + shape=shape, size=size, stroke=stroke, strokeCap=strokeCap, + strokeDash=strokeDash, strokeDashOffset=strokeDashOffset, + strokeJoin=strokeJoin, strokeMiterLimit=strokeMiterLimit, + strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, + style=style, tension=tension, text=text, theta=theta, + tooltip=tooltip, x2Offset=x2Offset, xOffset=xOffset, + y2Offset=y2Offset, yOffset=yOffset, **kwds) + + +class Padding(VegaLiteSchema): + """Padding schema wrapper + + anyOf(float, Mapping(required=[])) + """ + _schema = {'$ref': '#/definitions/Padding'} + _rootschema = Root._schema + + def __init__(self, *args, **kwds): + super(Padding, self).__init__(*args, **kwds) + + +class Parse(VegaLiteSchema): + """Parse schema wrapper + + Mapping(required=[]) + """ + _schema = {'$ref': '#/definitions/Parse'} + _rootschema = Root._schema + + def __init__(self, **kwds): + super(Parse, self).__init__(**kwds) + + +class PositionFieldDef(VegaLiteSchema): + """PositionFieldDef schema wrapper + + Mapping(required=[type]) + + Attributes + ---------- + + type : :class:`Type` + The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, + ``"ordinal"``, or ``"nominal"`` ). + It can also be a ``"geojson"`` type for encoding `'geoshape' + `__. + aggregate : :class:`Aggregate` + Aggregation function for the field + (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). + + **Default value:** ``undefined`` (None) + axis : anyOf(:class:`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, :class:`BinParams`) + A flag for binning a ``quantitative`` field, or `an object defining binning + parameters `__. + If ``true``, default `binning parameters + `__ will be applied. + + **Default value:** ``false`` + field : anyOf(string, :class:`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 if ``aggregate`` is ``count``. + scale : anyOf(:class:`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 : :class:`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 for ``row`` and ``column``. + stack : anyOf(:class:`StackOffset`, None) + Type of stacking offset if the field should be stacked. + ``stack`` is only applicable for ``x`` and ``y`` channels with continuous domains. + For example, ``stack`` of ``y`` 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 + `__. + :raw-html:`
` + - ``"center"`` - stacking with center baseline (for `streamgraph + `__ ). + * ``null`` - No-stacking. This will produce layered `bar + `__ and area + chart. + + **Default value:** ``zero`` for plots with all of the following conditions are true: + (1) the mark is ``bar`` or ``area`` ; + (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 : :class:`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`` and ``timeUnit`` ). 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. - **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 from ``config.style.bar`` and - ``config.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`` and ``y`` properties. Values for ``theta`` follow the same convention of - ``arc`` mark ``startAngle`` and ``endAngle`` properties: angles are measured in - radians, with ``0`` indicating "north". - thickness : float - Thickness of the tick mark. + **Notes** : - **Default value:** ``1`` - 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. + 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 legend ``title`` are + defined, axis/header/legend title will be used. """ - _schema = {'$ref': '#/definitions/MarkDef'} + _schema = {'$ref': '#/definitions/PositionFieldDef'} _rootschema = Root._schema - def __init__(self, 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): - super(MarkDef, self).__init__(type=type, align=align, angle=angle, baseline=baseline, - binSpacing=binSpacing, clip=clip, color=color, - cornerRadius=cornerRadius, cursor=cursor, dir=dir, dx=dx, dy=dy, - ellipsis=ellipsis, fill=fill, fillOpacity=fillOpacity, - filled=filled, font=font, fontSize=fontSize, fontStyle=fontStyle, - fontWeight=fontWeight, href=href, interpolate=interpolate, - limit=limit, line=line, opacity=opacity, orient=orient, - point=point, radius=radius, shape=shape, size=size, stroke=stroke, - strokeCap=strokeCap, strokeDash=strokeDash, - strokeDashOffset=strokeDashOffset, strokeJoin=strokeJoin, - strokeMiterLimit=strokeMiterLimit, strokeOpacity=strokeOpacity, - strokeWidth=strokeWidth, style=style, tension=tension, text=text, - theta=theta, thickness=thickness, tooltip=tooltip, - x2Offset=x2Offset, xOffset=xOffset, y2Offset=y2Offset, - yOffset=yOffset, **kwds) + def __init__(self, type=Undefined, aggregate=Undefined, axis=Undefined, bin=Undefined, + field=Undefined, scale=Undefined, sort=Undefined, stack=Undefined, timeUnit=Undefined, + title=Undefined, **kwds): + super(PositionFieldDef, self).__init__(type=type, aggregate=aggregate, axis=axis, bin=bin, + field=field, scale=scale, sort=sort, stack=stack, + timeUnit=timeUnit, title=title, **kwds) -class Month(VegaLiteSchema): - """Month schema wrapper +class Predicate(LogicalOperandPredicate): + """Predicate schema wrapper - float + anyOf(:class:`FieldEqualPredicate`, :class:`FieldRangePredicate`, + :class:`FieldOneOfPredicate`, :class:`FieldLTPredicate`, :class:`FieldGTPredicate`, + :class:`FieldLTEPredicate`, :class:`FieldGTEPredicate`, :class:`SelectionPredicate`, string) """ - _schema = {'$ref': '#/definitions/Month'} + _schema = {'$ref': '#/definitions/Predicate'} _rootschema = Root._schema - def __init__(self, *args): - super(Month, self).__init__(*args) + def __init__(self, *args, **kwds): + super(Predicate, self).__init__(*args, **kwds) -class MultiSelection(VegaLiteSchema): - """MultiSelection schema wrapper +class FieldEqualPredicate(Predicate): + """FieldEqualPredicate schema wrapper - Mapping(required=[type]) + Mapping(required=[equal, field]) Attributes ---------- - type : enum('multi') + equal : anyOf(string, float, boolean, :class:`DateTime`) + The value that the field should be equal to. + field : string + Field to be filtered. + timeUnit : :class:`TimeUnit` + Time unit for the field to be filtered. + """ + _schema = {'$ref': '#/definitions/FieldEqualPredicate'} + _rootschema = Root._schema - 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(:class:`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. + def __init__(self, equal=Undefined, field=Undefined, timeUnit=Undefined, **kwds): + super(FieldEqualPredicate, self).__init__(equal=equal, field=field, timeUnit=timeUnit, **kwds) - See the `nearest transform `__ - documentation for more information. - on : :class:`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 : :class:`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 to ``event.shiftKey`` (i.e., - data values are toggled when a user interacts with the shift-key pressed). +class FieldGTEPredicate(Predicate): + """FieldGTEPredicate schema wrapper - See the `toggle transform `__ - documentation for more information. + Mapping(required=[field, gte]) + + Attributes + ---------- + + field : string + Field to be filtered. + gte : anyOf(string, float, :class:`DateTime`) + The value that the field should be greater than or equals to. + timeUnit : :class:`TimeUnit` + Time unit for the field to be filtered. """ - _schema = {'$ref': '#/definitions/MultiSelection'} + _schema = {'$ref': '#/definitions/FieldGTEPredicate'} _rootschema = Root._schema - def __init__(self, type=Undefined, empty=Undefined, encodings=Undefined, fields=Undefined, - nearest=Undefined, on=Undefined, resolve=Undefined, toggle=Undefined, **kwds): - super(MultiSelection, self).__init__(type=type, empty=empty, encodings=encodings, fields=fields, - nearest=nearest, on=on, resolve=resolve, toggle=toggle, - **kwds) + def __init__(self, field=Undefined, gte=Undefined, timeUnit=Undefined, **kwds): + super(FieldGTEPredicate, self).__init__(field=field, gte=gte, timeUnit=timeUnit, **kwds) -class MultiSelectionConfig(VegaLiteSchema): - """MultiSelectionConfig schema wrapper +class FieldGTPredicate(Predicate): + """FieldGTPredicate schema wrapper - Mapping(required=[]) + Mapping(required=[field, gt]) 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(:class:`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. + field : string + Field to be filtered. + gt : anyOf(string, float, :class:`DateTime`) + The value that the field should be greater than. + timeUnit : :class:`TimeUnit` + Time unit for the field to be filtered. + """ + _schema = {'$ref': '#/definitions/FieldGTPredicate'} + _rootschema = Root._schema - See the `nearest transform `__ - documentation for more information. - on : :class:`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 : :class:`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 `__. + def __init__(self, field=Undefined, gt=Undefined, timeUnit=Undefined, **kwds): + super(FieldGTPredicate, self).__init__(field=field, gt=gt, timeUnit=timeUnit, **kwds) - **Default value:** ``true``, which corresponds to ``event.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 FieldLTEPredicate(Predicate): + """FieldLTEPredicate schema wrapper + + Mapping(required=[field, lte]) + + Attributes + ---------- + + field : string + Field to be filtered. + lte : anyOf(string, float, :class:`DateTime`) + The value that the field should be less than or equals to. + timeUnit : :class:`TimeUnit` + Time unit for the field to be filtered. """ - _schema = {'$ref': '#/definitions/MultiSelectionConfig'} + _schema = {'$ref': '#/definitions/FieldLTEPredicate'} _rootschema = Root._schema - def __init__(self, empty=Undefined, encodings=Undefined, fields=Undefined, nearest=Undefined, - on=Undefined, resolve=Undefined, toggle=Undefined, **kwds): - super(MultiSelectionConfig, self).__init__(empty=empty, encodings=encodings, fields=fields, - nearest=nearest, on=on, resolve=resolve, - toggle=toggle, **kwds) + def __init__(self, field=Undefined, lte=Undefined, timeUnit=Undefined, **kwds): + super(FieldLTEPredicate, self).__init__(field=field, lte=lte, timeUnit=timeUnit, **kwds) -class MultiTimeUnit(VegaLiteSchema): - """MultiTimeUnit schema wrapper +class FieldLTPredicate(Predicate): + """FieldLTPredicate schema wrapper - anyOf(:class:`LocalMultiTimeUnit`, :class:`UtcMultiTimeUnit`) + Mapping(required=[field, lt]) + + Attributes + ---------- + + field : string + Field to be filtered. + lt : anyOf(string, float, :class:`DateTime`) + The value that the field should be less than. + timeUnit : :class:`TimeUnit` + Time unit for the field to be filtered. """ - _schema = {'$ref': '#/definitions/MultiTimeUnit'} + _schema = {'$ref': '#/definitions/FieldLTPredicate'} _rootschema = Root._schema - def __init__(self, *args, **kwds): - super(MultiTimeUnit, self).__init__(*args, **kwds) + def __init__(self, field=Undefined, lt=Undefined, timeUnit=Undefined, **kwds): + super(FieldLTPredicate, self).__init__(field=field, lt=lt, timeUnit=timeUnit, **kwds) -class NamedData(VegaLiteSchema): - """NamedData schema wrapper +class FieldOneOfPredicate(Predicate): + """FieldOneOfPredicate schema wrapper - Mapping(required=[name]) + Mapping(required=[field, oneOf]) Attributes ---------- - name : string - Provide a placeholder name and bind data at runtime. - format : :class:`DataFormat` - An object that specifies the format for parsing the data. + field : string + Field to be filtered. + oneOf : anyOf(List(string), List(float), List(boolean), List(:class:`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 : :class:`TimeUnit` + Time unit for the field to be filtered. """ - _schema = {'$ref': '#/definitions/NamedData'} + _schema = {'$ref': '#/definitions/FieldOneOfPredicate'} _rootschema = Root._schema - def __init__(self, name=Undefined, format=Undefined, **kwds): - super(NamedData, self).__init__(name=name, format=format, **kwds) + def __init__(self, field=Undefined, oneOf=Undefined, timeUnit=Undefined, **kwds): + super(FieldOneOfPredicate, self).__init__(field=field, oneOf=oneOf, timeUnit=timeUnit, **kwds) -class NiceTime(VegaLiteSchema): - """NiceTime schema wrapper +class FieldRangePredicate(Predicate): + """FieldRangePredicate schema wrapper - enum('second', 'minute', 'hour', 'day', 'week', 'month', 'year') + Mapping(required=[field, range]) + + Attributes + ---------- + + field : string + Field to be filtered. + range : List(anyOf(float, :class:`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 : :class:`TimeUnit` + Time unit for the field to be filtered. """ - _schema = {'$ref': '#/definitions/NiceTime'} + _schema = {'$ref': '#/definitions/FieldRangePredicate'} _rootschema = Root._schema - def __init__(self, *args): - super(NiceTime, self).__init__(*args) + def __init__(self, field=Undefined, range=Undefined, timeUnit=Undefined, **kwds): + super(FieldRangePredicate, self).__init__(field=field, range=range, timeUnit=timeUnit, **kwds) -class OrderFieldDef(VegaLiteSchema): - """OrderFieldDef schema wrapper +class Projection(VegaLiteSchema): + """Projection schema wrapper - Mapping(required=[type]) + Mapping(required=[]) Attributes ---------- - type : :class:`Type` - The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, - ``"ordinal"``, or ``"nominal"`` ). - It can also be a ``"geojson"`` type for encoding `'geoshape' - `__. - aggregate : :class:`Aggregate` - Aggregation function for the field - (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). - - **Default value:** ``undefined`` (None) - bin : anyOf(boolean, :class:`BinParams`) - A flag for binning a ``quantitative`` field, or `an object defining binning - parameters `__. - If ``true``, default `binning parameters - `__ will be applied. + center : List(float) + Sets the projection’s center to the specified center, a two-element array of + longitude and latitude in degrees. - **Default value:** ``false`` - field : anyOf(string, :class:`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. + **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]]``, 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 - **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 - `__. + distance : float - **Note:** ``field`` is not required if ``aggregate`` is ``count``. - sort : :class:`SortOrder` - The sort order. One of ``"ascending"`` (default) or ``"descending"``. - timeUnit : :class:`TimeUnit` - Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal - field. - or `a temporal field that gets casted as ordinal - `__. + fraction : float - **Default value:** ``undefined`` (None) - title : anyOf(string, None) - A title for the field. If ``null``, the title will be removed. + lobes : float - **Default value:** derived from the field's name and transformation function ( - ``aggregate``, ``bin`` and ``timeUnit`` ). 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. + parallel : float - **Notes** : + 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 - 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 - `__. + ratio : float - 2) If both field definition's ``title`` and axis, header, or legend ``title`` are - defined, axis/header/legend title will be used. - """ - _schema = {'$ref': '#/definitions/OrderFieldDef'} - _rootschema = Root._schema + 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.) - def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, - sort=Undefined, timeUnit=Undefined, title=Undefined, **kwds): - super(OrderFieldDef, self).__init__(type=type, aggregate=aggregate, bin=bin, field=field, - sort=sort, timeUnit=timeUnit, title=title, **kwds) + **Default value:** ``[0, 0, 0]`` + spacing : float + tilt : float -class Orient(VegaLiteSchema): - """Orient schema wrapper + type : :class:`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 + `__. - enum('horizontal', 'vertical') + **Default value:** ``mercator`` """ - _schema = {'$ref': '#/definitions/Orient'} + _schema = {'$ref': '#/definitions/Projection'} _rootschema = Root._schema - def __init__(self, *args): - super(Orient, self).__init__(*args) + def __init__(self, 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): + super(Projection, self).__init__(center=center, clipAngle=clipAngle, clipExtent=clipExtent, + coefficient=coefficient, distance=distance, fraction=fraction, + lobes=lobes, parallel=parallel, precision=precision, + radius=radius, ratio=ratio, rotate=rotate, spacing=spacing, + tilt=tilt, type=type, **kwds) -class OverlayMarkDef(VegaLiteSchema): - """OverlayMarkDef schema wrapper +class ProjectionConfig(VegaLiteSchema): + """ProjectionConfig schema wrapper Mapping(required=[]) + Any property of Projection can be in config Attributes ---------- - align : :class:`HorizontalAlign` - The horizontal alignment of the text. One of ``"left"``, ``"right"``, ``"center"``. - angle : float - The rotation angle of the text, in degrees. - baseline : :class:`VerticalAlign` - The vertical alignment of the text. One of ``"top"``, ``"middle"``, ``"bottom"``. + center : List(float) + Sets the projection’s center to the specified center, a two-element array of + longitude and latitude in degrees. - **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`` and ``stroke`` have higher precedence than - ``color`` and will override ``color``. + **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]]``, 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 + `__ 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 : :class:`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`` + """ + _schema = {'$ref': '#/definitions/ProjectionConfig'} + _rootschema = Root._schema + + def __init__(self, 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): + super(ProjectionConfig, self).__init__(center=center, clipAngle=clipAngle, + clipExtent=clipExtent, coefficient=coefficient, + distance=distance, fraction=fraction, lobes=lobes, + parallel=parallel, precision=precision, radius=radius, + ratio=ratio, rotate=rotate, spacing=spacing, tilt=tilt, + type=type, **kwds) + + +class ProjectionType(VegaLiteSchema): + """ProjectionType schema wrapper + + enum('albers', 'albersUsa', 'azimuthalEqualArea', 'azimuthalEquidistant', 'conicConformal', + 'conicEqualArea', 'conicEquidistant', 'equirectangular', 'gnomonic', 'mercator', + 'orthographic', 'stereographic', 'transverseMercator') + """ + _schema = {'$ref': '#/definitions/ProjectionType'} + _rootschema = Root._schema - **Default value:** :raw-html:`` - ``"#4682b4"`` + def __init__(self, *args): + super(ProjectionType, self).__init__(*args) - **Note:** This property cannot be used in a `style config - `__. - cornerRadius : float - The radius in pixels of rounded rectangle corners. - **Default value:** ``0`` - cursor : :class:`Cursor` - The mouse cursor used over the mark. Any valid `CSS cursor type - `__ can be used. - dir : :class:`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. +class RangeConfig(VegaLiteSchema): + """RangeConfig schema wrapper - **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. + Mapping(required=[]) - **Default value:** ``"…"`` - fill : string - Default Fill Color. This has higher precedence than ``config.color`` + Attributes + ---------- - **Default value:** (None) - fillOpacity : float - The fill opacity (value between [0,1]). + category : anyOf(List(string), :class:`VgScheme`) + Default range for *nominal* (categorical) fields. + diverging : anyOf(List(string), :class:`VgScheme`) + Default range for diverging *quantitative* fields. + heatmap : anyOf(List(string), :class:`VgScheme`) + Default range for *quantitative* heatmaps. + ordinal : anyOf(List(string), :class:`VgScheme`) + Default range for *ordinal* fields. + ramp : anyOf(List(string), :class:`VgScheme`) + Default range for *quantitative* and *temporal* fields. + symbol : List(string) + Default range palette for the ``shape`` channel. + """ + _schema = {'$ref': '#/definitions/RangeConfig'} + _rootschema = Root._schema - **Default value:** ``1`` - filled : boolean - Whether the mark's color should be used as fill color instead of stroke color. + def __init__(self, category=Undefined, diverging=Undefined, heatmap=Undefined, ordinal=Undefined, + ramp=Undefined, symbol=Undefined, **kwds): + super(RangeConfig, self).__init__(category=category, diverging=diverging, heatmap=heatmap, + ordinal=ordinal, ramp=ramp, symbol=symbol, **kwds) - **Default value:** ``true`` for all marks except ``point`` and ``false`` for - ``point``. - **Applicable for:** ``bar``, ``point``, ``circle``, ``square``, and ``area`` marks. +class RangeConfigValue(VegaLiteSchema): + """RangeConfigValue schema wrapper - **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 : :class:`FontStyle` - The font style (e.g., ``"italic"`` ). - fontWeight : :class:`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 : :class:`Interpolate` - The line interpolation method to use for line and area marks. One of the following: + anyOf(List(anyOf(float, string)), :class:`VgScheme`, Mapping(required=[step])) + """ + _schema = {'$ref': '#/definitions/RangeConfigValue'} + _rootschema = Root._schema + def __init__(self, *args, **kwds): + super(RangeConfigValue, self).__init__(*args, **kwds) - * ``"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]). +class Repeat(VegaLiteSchema): + """Repeat schema wrapper - **Default value:** ``0.7`` for non-aggregate plots with ``point``, ``tick``, - ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. - orient : :class:`Orient` - The orientation of a non-stacked bar, tick, area, and line charts. - The value is either horizontal (default) or vertical. + Mapping(required=[]) + Attributes + ---------- - * 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`` and ``y`` 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. + column : List(string) + Horizontal repeated views. + row : List(string) + Vertical repeated views. + """ + _schema = {'$ref': '#/definitions/Repeat'} + _rootschema = Root._schema - **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. + def __init__(self, column=Undefined, row=Undefined, **kwds): + super(Repeat, self).__init__(column=column, row=row, **kwds) - **Default value:** ``30`` - stroke : string - Default Stroke Color. This has higher precedence than ``config.color`` - **Default value:** (None) - strokeCap : :class:`StrokeCap` - The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or - ``"square"``. +class RepeatRef(VegaLiteSchema): + """RepeatRef schema wrapper - **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 : :class:`StrokeJoin` - The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. + Mapping(required=[repeat]) + Reference to a repeated value. - **Default value:** ``"miter"`` - strokeMiterLimit : float - The miter limit at which to bevel a line join. - strokeOpacity : float - The stroke opacity (value between [0,1]). + Attributes + ---------- - **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. + repeat : enum('row', 'column') - **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 from ``config.style.bar`` and - ``config.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`` and ``y`` properties. Values for ``theta`` follow the same convention of - ``arc`` mark ``startAngle`` and ``endAngle`` properties: angles are measured in - radians, with ``0`` 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. """ - _schema = {'$ref': '#/definitions/OverlayMarkDef'} + _schema = {'$ref': '#/definitions/RepeatRef'} _rootschema = Root._schema - def __init__(self, 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): - super(OverlayMarkDef, self).__init__(align=align, angle=angle, baseline=baseline, clip=clip, - color=color, cornerRadius=cornerRadius, cursor=cursor, - dir=dir, dx=dx, dy=dy, ellipsis=ellipsis, fill=fill, - fillOpacity=fillOpacity, filled=filled, font=font, - fontSize=fontSize, fontStyle=fontStyle, - fontWeight=fontWeight, href=href, interpolate=interpolate, - limit=limit, opacity=opacity, orient=orient, radius=radius, - shape=shape, size=size, stroke=stroke, strokeCap=strokeCap, - strokeDash=strokeDash, strokeDashOffset=strokeDashOffset, - strokeJoin=strokeJoin, strokeMiterLimit=strokeMiterLimit, - strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, - style=style, tension=tension, text=text, theta=theta, - tooltip=tooltip, x2Offset=x2Offset, xOffset=xOffset, - y2Offset=y2Offset, yOffset=yOffset, **kwds) + def __init__(self, repeat=Undefined, **kwds): + super(RepeatRef, self).__init__(repeat=repeat, **kwds) + + +class Resolve(VegaLiteSchema): + """Resolve schema wrapper + + Mapping(required=[]) + Defines how scales, axes, and legends from different specs should be combined. Resolve is a + mapping from ``scale``, ``axis``, and ``legend`` to a mapping from channels to resolutions. + + Attributes + ---------- + axis : :class:`AxisResolveMap` -class Padding(VegaLiteSchema): - """Padding schema wrapper + legend : :class:`LegendResolveMap` + + scale : :class:`ScaleResolveMap` - anyOf(float, Mapping(required=[])) """ - _schema = {'$ref': '#/definitions/Padding'} + _schema = {'$ref': '#/definitions/Resolve'} _rootschema = Root._schema - def __init__(self, *args, **kwds): - super(Padding, self).__init__(*args, **kwds) + def __init__(self, axis=Undefined, legend=Undefined, scale=Undefined, **kwds): + super(Resolve, self).__init__(axis=axis, legend=legend, scale=scale, **kwds) -class Parse(VegaLiteSchema): - """Parse schema wrapper +class ResolveMode(VegaLiteSchema): + """ResolveMode schema wrapper + + enum('independent', 'shared') + """ + _schema = {'$ref': '#/definitions/ResolveMode'} + _rootschema = Root._schema + + def __init__(self, *args): + super(ResolveMode, self).__init__(*args) + + +class RowColVgLayoutAlign(VegaLiteSchema): + """RowColVgLayoutAlign schema wrapper Mapping(required=[]) + + Attributes + ---------- + + column : :class:`VgLayoutAlign` + + row : :class:`VgLayoutAlign` + """ - _schema = {'$ref': '#/definitions/Parse'} + _schema = {'$ref': '#/definitions/RowCol'} _rootschema = Root._schema - def __init__(self, **kwds): - super(Parse, self).__init__(**kwds) + def __init__(self, column=Undefined, row=Undefined, **kwds): + super(RowColVgLayoutAlign, self).__init__(column=column, row=row, **kwds) -class PositionFieldDef(VegaLiteSchema): - """PositionFieldDef schema wrapper +class RowColboolean(VegaLiteSchema): + """RowColboolean schema wrapper - Mapping(required=[type]) + Mapping(required=[]) Attributes ---------- - type : :class:`Type` - The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, - ``"ordinal"``, or ``"nominal"`` ). - It can also be a ``"geojson"`` type for encoding `'geoshape' - `__. - aggregate : :class:`Aggregate` - Aggregation function for the field - (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). + column : boolean - **Default value:** ``undefined`` (None) - axis : anyOf(:class:`Axis`, None) - An object defining properties of axis's gridlines, ticks and labels. - If ``null``, the axis for the encoding channel will be removed. + row : boolean - **Default value:** If undefined, default `axis properties - `__ are applied. - bin : anyOf(boolean, :class:`BinParams`) - A flag for binning a ``quantitative`` field, or `an object defining binning - parameters `__. - If ``true``, default `binning parameters - `__ will be applied. + """ + _schema = {'$ref': '#/definitions/RowCol'} + _rootschema = Root._schema - **Default value:** ``false`` - field : anyOf(string, :class:`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. + def __init__(self, column=Undefined, row=Undefined, **kwds): + super(RowColboolean, self).__init__(column=column, row=row, **kwds) - **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 if ``aggregate`` is ``count``. - scale : anyOf(:class:`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. +class RowColnumber(VegaLiteSchema): + """RowColnumber schema wrapper - If ``null``, the scale will be `disabled and the data value will be directly encoded - `__. + Mapping(required=[]) - **Default value:** If undefined, default `scale properties - `__ are applied. - sort : :class:`Sort` - Sort order for the encoded field. + Attributes + ---------- - For continuous fields (quantitative or temporal), ``sort`` can be either - ``"ascending"`` or ``"descending"``. + column : float - For discrete fields, ``sort`` can be one of the following: + row : float + """ + _schema = {'$ref': '#/definitions/RowCol'} + _rootschema = Root._schema - * ``"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. + def __init__(self, column=Undefined, row=Undefined, **kwds): + super(RowColnumber, self).__init__(column=column, row=row, **kwds) - **Default value:** ``"ascending"`` - **Note:** ``null`` is not supported for ``row`` and ``column``. - stack : anyOf(:class:`StackOffset`, None) - Type of stacking offset if the field should be stacked. - ``stack`` is only applicable for ``x`` and ``y`` channels with continuous domains. - For example, ``stack`` of ``y`` can be used to customize stacking for a vertical bar - chart. +class Scale(VegaLiteSchema): + """Scale schema wrapper - ``stack`` can be one of the following values: + Mapping(required=[]) + Attributes + ---------- - * `"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 - `__. - :raw-html:`
` - - ``"center"`` - stacking with center baseline (for `streamgraph - `__ ). - * ``null`` - No-stacking. This will produce layered `bar - `__ and area - chart. + base : float + The logarithm base of the ``log`` scale (default ``10`` ). + clamp : boolean + If ``true``, values that exceed the data domain are clamped to either the minimum or + maximum range value - **Default value:** ``zero`` for plots with all of the following conditions are true: - (1) the mark is ``bar`` or ``area`` ; - (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 : :class:`TimeUnit` - Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal - field. - or `a temporal field that gets casted as ordinal - `__. + **Default value:** derived from the `scale config + `__ 's ``clamp`` ( + ``true`` by default). + domain : anyOf(List(float), List(string), List(boolean), List(:class:`DateTime`), + enum('unaggregated'), :class:`SelectionDomain`) + Customized domain values. - **Default value:** ``undefined`` (None) - title : anyOf(string, None) - A title for the field. If ``null``, the title will be removed. + 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 a ``domain`` 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. - **Default value:** derived from the field's name and transformation function ( - ``aggregate``, ``bin`` and ``timeUnit`` ). 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. + 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 + `__. - **Notes** : + For *ordinal* and *nominal* fields, ``domain`` can be an array that lists valid + input values. - 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 - `__. + The ``selection`` property can be used to `interactively determine + `__ the scale + domain. + exponent : float + The exponent of the ``pow`` scale. + interpolate : anyOf(:class:`ScaleInterpolate`, :class:`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`` and + ``cubehelix-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 + `__. - 2) If both field definition's ``title`` and axis, header, or legend ``title`` are - defined, axis/header/legend title will be used. - """ - _schema = {'$ref': '#/definitions/PositionFieldDef'} - _rootschema = Root._schema + **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 scale ``type`` to other quantitative scale type such as + ``"linear"`` to customize ``interpolate``. + nice : anyOf(boolean, float, :class:`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. If ``nice`` 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`` and ``utc`` 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`` and ``paddingOuter`` to the same value. + + For * `point `__ * scales, + alias for ``paddingOuter``. - def __init__(self, type=Undefined, aggregate=Undefined, axis=Undefined, bin=Undefined, - field=Undefined, scale=Undefined, sort=Undefined, stack=Undefined, timeUnit=Undefined, - title=Undefined, **kwds): - super(PositionFieldDef, self).__init__(type=type, aggregate=aggregate, axis=axis, bin=bin, - field=field, scale=scale, sort=sort, stack=stack, - timeUnit=timeUnit, title=title, **kwds) + **Default value:** For *continuous* scales, derived from the `scale config + `__ 's + ``continuousPadding``. + For *band and point* scales, see ``paddingInner`` and ``paddingOuter``. + 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). -class Predicate(VegaLiteSchema): - """Predicate schema wrapper + **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]. - anyOf(:class:`FieldEqualPredicate`, :class:`FieldRangePredicate`, - :class:`FieldOneOfPredicate`, :class:`FieldLTPredicate`, :class:`FieldGTPredicate`, - :class:`FieldLTEPredicate`, :class:`FieldGTEPredicate`, :class:`SelectionPredicate`, string) - """ - _schema = {'$ref': '#/definitions/Predicate'} - _rootschema = Root._schema + **Default value:** derived from the `scale config + `__ 's ``bandPaddingOuter`` + for band scales and ``pointPadding`` for point scales. + range : anyOf(List(float), List(string), string) + The range of the scale. One of: - def __init__(self, *args, **kwds): - super(Predicate, self).__init__(*args, **kwds) + A string indicating a `pre-defined named scale range + `__ (e.g., example, + ``"symbol"``, or ``"diverging"`` ). -class Projection(VegaLiteSchema): - """Projection schema wrapper + For `continuous scales + `__, two-element array + indicating minimum and maximum values, or an array with more than two entries for + specifying a `piecewise scale + `__. - Mapping(required=[]) + For `discrete `__ and + `discretizing `__ + scales, an array of desired output values. - Attributes - ---------- + **Notes:** - center : List(float) - Sets the projection’s center to the specified center, a two-element array of - longitude and latitude in degrees. + 1) For `sequential `__, + `ordinal `__, and + discretizing color scales, you can also specify a color `scheme + `__ instead of ``range``. - **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]]``, 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 + 2) Any directly specified ``range`` for ``x`` and ``y`` channels will be ignored. + Range can be customized via the view's corresponding `size + `__ ( ``width`` and ``height`` ) or + via `range steps and paddings properties <#range-step>`__ for `band <#band>`__ and + `point <#point>`__ scales. + rangeStep : anyOf(float, None) + The distance between the starts of adjacent bands or points in `band + `__ and `point + `__ scales. - distance : float + If ``rangeStep`` is ``null`` or if the view contains the scale's corresponding `size + `__ ( ``width`` for ``x`` scales + and ``height`` for ``y`` scales), ``rangeStep`` will be automatically determined to + fit the size of the view. - fraction : float + **Default value:** derived the `scale config + `__ 's + ``textXRangeStep`` ( ``90`` by default) for x-scales of ``text`` marks and + ``rangeStep`` ( ``21`` by default) for x-scales of other marks and y-scales. - lobes : float + **Warning** : If ``rangeStep`` is ``null`` and the cardinality of the scale's domain + is higher than ``width`` or ``height``, 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. - parallel : float + **Default value:** ``false``. + scheme : anyOf(string, :class:`SchemeParams`) + A string indicating a color `scheme + `__ name (e.g., + ``"category10"`` or ``"viridis"`` ) or a `scheme parameter object + `__. - 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 + Discrete color schemes may be used with `discrete + `__ or `discretizing + `__ scales. + Continuous color schemes are intended for use with `sequential + `__ scales. - ratio : float + For the full list of supported schemes, please refer to the `Vega Scheme + `__ reference. + type : :class:`ScaleType` + The type of scale. Vega-Lite supports the following categories of scale types: - 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.) + 1) `Continuous Scales + `__ -- mapping + continuous domains to continuous output ranges ( `"linear" + `__, `"pow" + `__, `"sqrt" + `__, `"log" + `__, `"time" + `__, `"utc" + `__, `"sequential" + `__ ). - **Default value:** ``[0, 0, 0]`` - spacing : float + 2) `Discrete Scales `__ + -- mapping discrete domains to discrete ( `"ordinal" + `__ ) or continuous ( + `"band" `__ and `"point" + `__ ) output ranges. - tilt : float + 3) `Discretizing Scales + `__ -- mapping + continuous domains to discrete output ranges ( `"bin-linear" + `__ and `"bin-ordinal" + `__ ). - type : :class:`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:** please see the `scale type table + `__. + zero : boolean + If ``true``, ensures that a zero baseline value is included in the scale domain. - **Default value:** ``mercator`` + **Default value:** ``true`` for x and y channels if the quantitative field is not + binned and no custom ``domain`` is provided; ``false`` otherwise. + + **Note:** Log, time, and utc scales do not support ``zero``. """ - _schema = {'$ref': '#/definitions/Projection'} + _schema = {'$ref': '#/definitions/Scale'} _rootschema = Root._schema - def __init__(self, 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): - super(Projection, self).__init__(center=center, clipAngle=clipAngle, clipExtent=clipExtent, - coefficient=coefficient, distance=distance, fraction=fraction, - lobes=lobes, parallel=parallel, precision=precision, - radius=radius, ratio=ratio, rotate=rotate, spacing=spacing, - tilt=tilt, type=type, **kwds) + def __init__(self, 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): + super(Scale, self).__init__(base=base, clamp=clamp, domain=domain, exponent=exponent, + interpolate=interpolate, nice=nice, padding=padding, + paddingInner=paddingInner, paddingOuter=paddingOuter, range=range, + rangeStep=rangeStep, round=round, scheme=scheme, type=type, + zero=zero, **kwds) -class ProjectionConfig(VegaLiteSchema): - """ProjectionConfig schema wrapper +class ScaleConfig(VegaLiteSchema): + """ScaleConfig 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]]``, 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 + bandPaddingInner : float + Default inner padding for ``x`` and ``y`` band-ordinal scales. - 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 + **Default value:** ``0.1`` + bandPaddingOuter : float + Default outer padding for ``x`` and ``y`` 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. - ratio : float + **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. - 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.) + 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:** ``[0, 0, 0]`` - spacing : float + **Default value:** ``40`` + maxOpacity : float + Default max opacity for mapping a field to opacity. - tilt : float + **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. - type : :class:`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:** ``4`` + minBandSize : float + The default min value for mapping quantitative fields to bar and tick's + size/bandSize scale with zero=false. - **Default value:** ``mercator`` - """ - _schema = {'$ref': '#/definitions/ProjectionConfig'} - _rootschema = Root._schema + **Default value:** ``2`` + minFontSize : float + The default min value for mapping quantitative fields to tick's size/fontSize scale + with zero=false - def __init__(self, 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): - super(ProjectionConfig, self).__init__(center=center, clipAngle=clipAngle, - clipExtent=clipExtent, coefficient=coefficient, - distance=distance, fraction=fraction, lobes=lobes, - parallel=parallel, precision=precision, radius=radius, - ratio=ratio, rotate=rotate, spacing=spacing, tilt=tilt, - type=type, **kwds) + **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. -class ProjectionType(VegaLiteSchema): - """ProjectionType schema wrapper + **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. - enum('albers', 'albersUsa', 'azimuthalEqualArea', 'azimuthalEquidistant', 'conicConformal', - 'conicEqualArea', 'conicEquidistant', 'equirectangular', 'gnomonic', 'mercator', - 'orthographic', 'stereographic', 'transverseMercator') - """ - _schema = {'$ref': '#/definitions/ProjectionType'} - _rootschema = Root._schema + **Default value:** ``1`` + pointPadding : float + Default outer padding for ``x`` and ``y`` point-ordinal scales. - def __init__(self, *args): - super(ProjectionType, self).__init__(*args) + **Default value:** ``0.5`` + rangeStep : anyOf(float, None) + Default range step for band and point scales of (1) the ``y`` channel + and (2) the ``x`` channel when the mark is not ``text``. + **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``, and ``size`` scales.) + textXRangeStep : float + Default range step for ``x`` band and point scales of text marks. -class RangeConfig(VegaLiteSchema): - """RangeConfig schema wrapper + **Default value:** ``90`` + useUnaggregatedDomain : boolean + Use the source data range before aggregation as scale domain instead of aggregated + data for aggregate axis. - Mapping(required=[]) + This is equivalent to setting ``domain`` to ``"unaggregate"`` for aggregated + *quantitative* fields by default. - Attributes - ---------- + 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. - category : anyOf(List(string), :class:`VgScheme`) - Default range for *nominal* (categorical) fields. - diverging : anyOf(List(string), :class:`VgScheme`) - Default range for diverging *quantitative* fields. - heatmap : anyOf(List(string), :class:`VgScheme`) - Default range for *quantitative* heatmaps. - ordinal : anyOf(List(string), :class:`VgScheme`) - Default range for *ordinal* fields. - ramp : anyOf(List(string), :class:`VgScheme`) - Default range for *quantitative* and *temporal* fields. - symbol : List(string) - Default range palette for the ``shape`` channel. + **Default value:** ``false`` """ - _schema = {'$ref': '#/definitions/RangeConfig'} + _schema = {'$ref': '#/definitions/ScaleConfig'} _rootschema = Root._schema - def __init__(self, category=Undefined, diverging=Undefined, heatmap=Undefined, ordinal=Undefined, - ramp=Undefined, symbol=Undefined, **kwds): - super(RangeConfig, self).__init__(category=category, diverging=diverging, heatmap=heatmap, - ordinal=ordinal, ramp=ramp, symbol=symbol, **kwds) + def __init__(self, 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): + super(ScaleConfig, self).__init__(bandPaddingInner=bandPaddingInner, + bandPaddingOuter=bandPaddingOuter, clamp=clamp, + continuousPadding=continuousPadding, maxBandSize=maxBandSize, + maxFontSize=maxFontSize, maxOpacity=maxOpacity, + maxSize=maxSize, maxStrokeWidth=maxStrokeWidth, + minBandSize=minBandSize, minFontSize=minFontSize, + minOpacity=minOpacity, minSize=minSize, + minStrokeWidth=minStrokeWidth, pointPadding=pointPadding, + rangeStep=rangeStep, round=round, + textXRangeStep=textXRangeStep, + useUnaggregatedDomain=useUnaggregatedDomain, **kwds) -class RangeConfigValue(VegaLiteSchema): - """RangeConfigValue schema wrapper +class ScaleInterpolate(VegaLiteSchema): + """ScaleInterpolate schema wrapper - anyOf(List(anyOf(float, string)), :class:`VgScheme`, Mapping(required=[step])) + enum('rgb', 'lab', 'hcl', 'hsl', 'hsl-long', 'hcl-long', 'cubehelix', 'cubehelix-long') """ - _schema = {'$ref': '#/definitions/RangeConfigValue'} + _schema = {'$ref': '#/definitions/ScaleInterpolate'} _rootschema = Root._schema - def __init__(self, *args, **kwds): - super(RangeConfigValue, self).__init__(*args, **kwds) + def __init__(self, *args): + super(ScaleInterpolate, self).__init__(*args) -class Repeat(VegaLiteSchema): - """Repeat schema wrapper +class ScaleInterpolateParams(VegaLiteSchema): + """ScaleInterpolateParams schema wrapper - Mapping(required=[]) + Mapping(required=[type]) Attributes ---------- - column : List(string) - Horizontal repeated views. - row : List(string) - Vertical repeated views. + type : enum('rgb', 'cubehelix', 'cubehelix-long') + + gamma : float + """ - _schema = {'$ref': '#/definitions/Repeat'} + _schema = {'$ref': '#/definitions/ScaleInterpolateParams'} _rootschema = Root._schema - def __init__(self, column=Undefined, row=Undefined, **kwds): - super(Repeat, self).__init__(column=column, row=row, **kwds) + def __init__(self, type=Undefined, gamma=Undefined, **kwds): + super(ScaleInterpolateParams, self).__init__(type=type, gamma=gamma, **kwds) -class RepeatRef(VegaLiteSchema): - """RepeatRef schema wrapper +class ScaleResolveMap(VegaLiteSchema): + """ScaleResolveMap schema wrapper - Mapping(required=[repeat]) - Reference to a repeated value. + Mapping(required=[]) Attributes ---------- - repeat : enum('row', 'column') - - """ - _schema = {'$ref': '#/definitions/RepeatRef'} - _rootschema = Root._schema - - def __init__(self, repeat=Undefined, **kwds): - super(RepeatRef, self).__init__(repeat=repeat, **kwds) + color : :class:`ResolveMode` + fill : :class:`ResolveMode` -class Resolve(VegaLiteSchema): - """Resolve schema wrapper + opacity : :class:`ResolveMode` - Mapping(required=[]) - Defines how scales, axes, and legends from different specs should be combined. Resolve is a - mapping from ``scale``, ``axis``, and ``legend`` to a mapping from channels to resolutions. + shape : :class:`ResolveMode` - Attributes - ---------- + size : :class:`ResolveMode` - axis : :class:`AxisResolveMap` + stroke : :class:`ResolveMode` - legend : :class:`LegendResolveMap` + x : :class:`ResolveMode` - scale : :class:`ScaleResolveMap` + y : :class:`ResolveMode` """ - _schema = {'$ref': '#/definitions/Resolve'} + _schema = {'$ref': '#/definitions/ScaleResolveMap'} _rootschema = Root._schema - def __init__(self, axis=Undefined, legend=Undefined, scale=Undefined, **kwds): - super(Resolve, self).__init__(axis=axis, legend=legend, scale=scale, **kwds) + def __init__(self, color=Undefined, fill=Undefined, opacity=Undefined, shape=Undefined, + size=Undefined, stroke=Undefined, x=Undefined, y=Undefined, **kwds): + super(ScaleResolveMap, self).__init__(color=color, fill=fill, opacity=opacity, shape=shape, + size=size, stroke=stroke, x=x, y=y, **kwds) -class ResolveMode(VegaLiteSchema): - """ResolveMode schema wrapper +class ScaleType(VegaLiteSchema): + """ScaleType schema wrapper - enum('independent', 'shared') + enum('linear', 'bin-linear', 'log', 'pow', 'sqrt', 'time', 'utc', 'sequential', 'ordinal', + 'bin-ordinal', 'point', 'band') """ - _schema = {'$ref': '#/definitions/ResolveMode'} + _schema = {'$ref': '#/definitions/ScaleType'} _rootschema = Root._schema def __init__(self, *args): - super(ResolveMode, self).__init__(*args) + super(ScaleType, self).__init__(*args) -class RowColVgLayoutAlign(VegaLiteSchema): - """RowColVgLayoutAlign schema wrapper +class SchemeParams(VegaLiteSchema): + """SchemeParams schema wrapper - Mapping(required=[]) + Mapping(required=[name]) Attributes ---------- - column : :class:`VgLayoutAlign` - - row : :class:`VgLayoutAlign` + 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. """ - _schema = {'$ref': '#/definitions/RowCol'} + _schema = {'$ref': '#/definitions/SchemeParams'} _rootschema = Root._schema - def __init__(self, column=Undefined, row=Undefined, **kwds): - super(RowColVgLayoutAlign, self).__init__(column=column, row=row, **kwds) + def __init__(self, name=Undefined, extent=Undefined, **kwds): + super(SchemeParams, self).__init__(name=name, extent=extent, **kwds) -class RowColboolean(VegaLiteSchema): - """RowColboolean schema wrapper +class SelectionConfig(VegaLiteSchema): + """SelectionConfig schema wrapper Mapping(required=[]) Attributes ---------- - column : boolean + interval : :class:`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 : :class:`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 : :class:`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. + """ + _schema = {'$ref': '#/definitions/SelectionConfig'} + _rootschema = Root._schema + + def __init__(self, interval=Undefined, multi=Undefined, single=Undefined, **kwds): + super(SelectionConfig, self).__init__(interval=interval, multi=multi, single=single, **kwds) + - row : boolean +class SelectionDef(VegaLiteSchema): + """SelectionDef schema wrapper + anyOf(:class:`SingleSelection`, :class:`MultiSelection`, :class:`IntervalSelection`) """ - _schema = {'$ref': '#/definitions/RowCol'} + _schema = {'$ref': '#/definitions/SelectionDef'} _rootschema = Root._schema - def __init__(self, column=Undefined, row=Undefined, **kwds): - super(RowColboolean, self).__init__(column=column, row=row, **kwds) + def __init__(self, *args, **kwds): + super(SelectionDef, self).__init__(*args, **kwds) -class RowColnumber(VegaLiteSchema): - """RowColnumber schema wrapper +class IntervalSelection(SelectionDef): + """IntervalSelection schema wrapper - Mapping(required=[]) + Mapping(required=[type]) Attributes ---------- - column : float + type : enum('interval') - row : float + 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(:class:`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 : :class:`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 : :class:`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 : :class:`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, + only ``wheel`` events are supported. + **Default value:** ``true``, which corresponds to ``wheel!``. """ - _schema = {'$ref': '#/definitions/RowCol'} + _schema = {'$ref': '#/definitions/IntervalSelection'} _rootschema = Root._schema - def __init__(self, column=Undefined, row=Undefined, **kwds): - super(RowColnumber, self).__init__(column=column, row=row, **kwds) + def __init__(self, type=Undefined, bind=Undefined, empty=Undefined, encodings=Undefined, + fields=Undefined, mark=Undefined, on=Undefined, resolve=Undefined, translate=Undefined, + zoom=Undefined, **kwds): + super(IntervalSelection, self).__init__(type=type, bind=bind, empty=empty, encodings=encodings, + fields=fields, mark=mark, on=on, resolve=resolve, + translate=translate, zoom=zoom, **kwds) -class Scale(VegaLiteSchema): - """Scale schema wrapper +class MultiSelection(SelectionDef): + """MultiSelection schema wrapper - Mapping(required=[]) + Mapping(required=[type]) Attributes ---------- - base : float - The logarithm base of the ``log`` scale (default ``10`` ). - clamp : boolean - If ``true``, values that exceed the data domain are clamped to either the minimum or - maximum range value - - **Default value:** derived from the `scale config - `__ 's ``clamp`` ( - ``true`` by default). - domain : anyOf(List(float), List(string), List(boolean), List(:class:`DateTime`), - enum('unaggregated'), :class:`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 a ``domain`` 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 - `__. + type : enum('multi') - For *ordinal* and *nominal* fields, ``domain`` can be an array that lists valid - input values. + 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(:class:`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. - The ``selection`` property can be used to `interactively determine - `__ the scale - domain. - exponent : float - The exponent of the ``pow`` scale. - interpolate : anyOf(:class:`ScaleInterpolate`, :class:`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`` and - ``cubehelix-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 - `__. + See the `nearest transform `__ + documentation for more information. + on : :class:`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 : :class:`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 `__. - **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 scale ``type`` to other quantitative scale type such as - ``"linear"`` to customize ``interpolate``. - nice : anyOf(boolean, float, :class:`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]*. + **Default value:** ``true``, which corresponds to ``event.shiftKey`` (i.e., + data values are toggled when a user interacts with the shift-key pressed). - For quantitative scales such as linear, ``nice`` can be either a boolean flag or a - number. If ``nice`` 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. + See the `toggle transform `__ + documentation for more information. + """ + _schema = {'$ref': '#/definitions/MultiSelection'} + _rootschema = Root._schema - 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`` and ``utc`` 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. + def __init__(self, type=Undefined, empty=Undefined, encodings=Undefined, fields=Undefined, + nearest=Undefined, on=Undefined, resolve=Undefined, toggle=Undefined, **kwds): + super(MultiSelection, self).__init__(type=type, empty=empty, encodings=encodings, fields=fields, + nearest=nearest, on=on, resolve=resolve, toggle=toggle, + **kwds) - **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`` and ``paddingOuter`` to the same value. +class SelectionDomain(VegaLiteSchema): + """SelectionDomain schema wrapper - For * `point `__ * scales, - alias for ``paddingOuter``. + anyOf(Mapping(required=[selection]), Mapping(required=[selection])) + """ + _schema = {'$ref': '#/definitions/SelectionDomain'} + _rootschema = Root._schema - **Default value:** For *continuous* scales, derived from the `scale config - `__ 's - ``continuousPadding``. - For *band and point* scales, see ``paddingInner`` and ``paddingOuter``. - 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]. + def __init__(self, *args, **kwds): + super(SelectionDomain, self).__init__(*args, **kwds) - 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]. +class SelectionOperand(VegaLiteSchema): + """SelectionOperand schema wrapper - **Default value:** derived from the `scale config - `__ 's ``bandPaddingOuter`` - for band scales and ``pointPadding`` for point scales. - range : anyOf(List(float), List(string), string) - The range of the scale. One of: + anyOf(:class:`SelectionNot`, :class:`SelectionAnd`, :class:`SelectionOr`, string) + """ + _schema = {'$ref': '#/definitions/SelectionOperand'} + _rootschema = Root._schema + def __init__(self, *args, **kwds): + super(SelectionOperand, self).__init__(*args, **kwds) - 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 - `__. +class SelectionAnd(SelectionOperand): + """SelectionAnd schema wrapper - For `discrete `__ and - `discretizing `__ - scales, an array of desired output values. + Mapping(required=[and]) - **Notes:** + Attributes + ---------- - 1) For `sequential `__, - `ordinal `__, and - discretizing color scales, you can also specify a color `scheme - `__ instead of ``range``. + and : List(:class:`SelectionOperand`) - 2) Any directly specified ``range`` for ``x`` and ``y`` channels will be ignored. - Range can be customized via the view's corresponding `size - `__ ( ``width`` and ``height`` ) or - via `range steps and paddings properties <#range-step>`__ for `band <#band>`__ and - `point <#point>`__ scales. - rangeStep : anyOf(float, None) - The distance between the starts of adjacent bands or points in `band - `__ and `point - `__ scales. + """ + _schema = {'$ref': '#/definitions/SelectionAnd'} + _rootschema = Root._schema - If ``rangeStep`` is ``null`` or if the view contains the scale's corresponding `size - `__ ( ``width`` for ``x`` scales - and ``height`` for ``y`` scales), ``rangeStep`` will be automatically determined to - fit the size of the view. + def __init__(self, **kwds): + super(SelectionAnd, self).__init__(**kwds) - **Default value:** derived the `scale config - `__ 's - ``textXRangeStep`` ( ``90`` by default) for x-scales of ``text`` marks and - ``rangeStep`` ( ``21`` by default) for x-scales of other marks and y-scales. - **Warning** : If ``rangeStep`` is ``null`` and the cardinality of the scale's domain - is higher than ``width`` or ``height``, 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. +class SelectionNot(SelectionOperand): + """SelectionNot schema wrapper - **Default value:** ``false``. - scheme : anyOf(string, :class:`SchemeParams`) - A string indicating a color `scheme - `__ name (e.g., - ``"category10"`` or ``"viridis"`` ) or a `scheme parameter object - `__. + Mapping(required=[not]) - Discrete color schemes may be used with `discrete - `__ or `discretizing - `__ scales. - Continuous color schemes are intended for use with `sequential - `__ scales. + Attributes + ---------- - For the full list of supported schemes, please refer to the `Vega Scheme - `__ reference. - type : :class:`ScaleType` - The type of scale. Vega-Lite supports the following categories of scale types: + not : :class:`SelectionOperand` - 1) `Continuous Scales - `__ -- mapping - continuous domains to continuous output ranges ( `"linear" - `__, `"pow" - `__, `"sqrt" - `__, `"log" - `__, `"time" - `__, `"utc" - `__, `"sequential" - `__ ). + """ + _schema = {'$ref': '#/definitions/SelectionNot'} + _rootschema = Root._schema - 2) `Discrete Scales `__ - -- mapping discrete domains to discrete ( `"ordinal" - `__ ) or continuous ( - `"band" `__ and `"point" - `__ ) output ranges. + def __init__(self, **kwds): + super(SelectionNot, self).__init__(**kwds) - 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. +class SelectionOr(SelectionOperand): + """SelectionOr schema wrapper - **Default value:** ``true`` for x and y channels if the quantitative field is not - binned and no custom ``domain`` is provided; ``false`` otherwise. + Mapping(required=[or]) + + Attributes + ---------- + + or : List(:class:`SelectionOperand`) - **Note:** Log, time, and utc scales do not support ``zero``. """ - _schema = {'$ref': '#/definitions/Scale'} + _schema = {'$ref': '#/definitions/SelectionOr'} _rootschema = Root._schema - def __init__(self, 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): - super(Scale, self).__init__(base=base, clamp=clamp, domain=domain, exponent=exponent, - interpolate=interpolate, nice=nice, padding=padding, - paddingInner=paddingInner, paddingOuter=paddingOuter, range=range, - rangeStep=rangeStep, round=round, scheme=scheme, type=type, - zero=zero, **kwds) + def __init__(self, **kwds): + super(SelectionOr, self).__init__(**kwds) -class ScaleConfig(VegaLiteSchema): - """ScaleConfig schema wrapper +class SelectionPredicate(Predicate): + """SelectionPredicate schema wrapper - Mapping(required=[]) + Mapping(required=[selection]) Attributes ---------- - bandPaddingInner : float - Default inner padding for ``x`` and ``y`` band-ordinal scales. + selection : :class:`SelectionOperand` + Filter using a selection name. + """ + _schema = {'$ref': '#/definitions/SelectionPredicate'} + _rootschema = Root._schema - **Default value:** ``0.1`` - bandPaddingOuter : float - Default outer padding for ``x`` and ``y`` 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. + def __init__(self, selection=Undefined, **kwds): + super(SelectionPredicate, self).__init__(selection=selection, **kwds) - **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. +class SelectionResolution(VegaLiteSchema): + """SelectionResolution schema wrapper - **Default value:** ``40`` - maxOpacity : float - Default max opacity for mapping a field to opacity. + enum('global', 'union', 'intersect') + """ + _schema = {'$ref': '#/definitions/SelectionResolution'} + _rootschema = Root._schema - **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. + def __init__(self, *args): + super(SelectionResolution, self).__init__(*args) - **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 +class SingleDefChannel(VegaLiteSchema): + """SingleDefChannel schema wrapper - **Default value:** ``8`` - minOpacity : float - Default minimum opacity for mapping a field to opacity. + enum('x', 'y', 'x2', 'y2', 'longitude', 'latitude', 'longitude2', 'latitude2', 'row', + 'column', 'color', 'fill', 'stroke', 'size', 'shape', 'opacity', 'text', 'tooltip', 'href', + 'key') + """ + _schema = {'$ref': '#/definitions/SingleDefChannel'} + _rootschema = Root._schema - **Default value:** ``0.3`` - minSize : float - Default minimum value for point size scale with zero=false. + def __init__(self, *args): + super(SingleDefChannel, self).__init__(*args) - **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`` and ``y`` point-ordinal scales. +class SingleSelection(SelectionDef): + """SingleSelection schema wrapper - **Default value:** ``0.5`` - rangeStep : anyOf(float, None) - Default range step for band and point scales of (1) the ``y`` channel - and (2) the ``x`` channel when the mark is not ``text``. + Mapping(required=[type]) - **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``, and ``size`` scales.) - textXRangeStep : float - Default range step for ``x`` band and point scales of text marks. + Attributes + ---------- - **Default value:** ``90`` - useUnaggregatedDomain : boolean - Use the source data range before aggregation as scale domain instead of aggregated - data for aggregate axis. + type : enum('single') - This is equivalent to setting ``domain`` to ``"unaggregate"`` for aggregated - *quantitative* fields by default. + bind : anyOf(:class:`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. - 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. + 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(:class:`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 : :class:`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 : :class:`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. + """ + _schema = {'$ref': '#/definitions/SingleSelection'} + _rootschema = Root._schema + + def __init__(self, type=Undefined, bind=Undefined, empty=Undefined, encodings=Undefined, + fields=Undefined, nearest=Undefined, on=Undefined, resolve=Undefined, **kwds): + super(SingleSelection, self).__init__(type=type, bind=bind, empty=empty, encodings=encodings, + fields=fields, nearest=nearest, on=on, resolve=resolve, + **kwds) + + +class SingleSelectionConfig(VegaLiteSchema): + """SingleSelectionConfig schema wrapper + + Mapping(required=[]) + + Attributes + ---------- + + bind : anyOf(:class:`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(:class:`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. - **Default value:** ``false`` + See the `nearest transform `__ + documentation for more information. + on : :class:`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 : :class:`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. """ - _schema = {'$ref': '#/definitions/ScaleConfig'} + _schema = {'$ref': '#/definitions/SingleSelectionConfig'} _rootschema = Root._schema - def __init__(self, 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): - super(ScaleConfig, self).__init__(bandPaddingInner=bandPaddingInner, - bandPaddingOuter=bandPaddingOuter, clamp=clamp, - continuousPadding=continuousPadding, maxBandSize=maxBandSize, - maxFontSize=maxFontSize, maxOpacity=maxOpacity, - maxSize=maxSize, maxStrokeWidth=maxStrokeWidth, - minBandSize=minBandSize, minFontSize=minFontSize, - minOpacity=minOpacity, minSize=minSize, - minStrokeWidth=minStrokeWidth, pointPadding=pointPadding, - rangeStep=rangeStep, round=round, - textXRangeStep=textXRangeStep, - useUnaggregatedDomain=useUnaggregatedDomain, **kwds) + def __init__(self, bind=Undefined, empty=Undefined, encodings=Undefined, fields=Undefined, + nearest=Undefined, on=Undefined, resolve=Undefined, **kwds): + super(SingleSelectionConfig, self).__init__(bind=bind, empty=empty, encodings=encodings, + fields=fields, nearest=nearest, on=on, + resolve=resolve, **kwds) -class ScaleInterpolate(VegaLiteSchema): - """ScaleInterpolate schema wrapper +class Sort(VegaLiteSchema): + """Sort schema wrapper - enum('rgb', 'lab', 'hcl', 'hsl', 'hsl-long', 'hcl-long', 'cubehelix', 'cubehelix-long') + anyOf(List(float), List(string), List(boolean), List(:class:`DateTime`), :class:`SortOrder`, + :class:`EncodingSortField`, None) """ - _schema = {'$ref': '#/definitions/ScaleInterpolate'} + _schema = {'$ref': '#/definitions/Sort'} _rootschema = Root._schema - def __init__(self, *args): - super(ScaleInterpolate, self).__init__(*args) + def __init__(self, *args, **kwds): + super(Sort, self).__init__(*args, **kwds) -class ScaleInterpolateParams(VegaLiteSchema): - """ScaleInterpolateParams schema wrapper +class EncodingSortField(Sort): + """EncodingSortField schema wrapper - Mapping(required=[type]) + Mapping(required=[op]) + A sort definition for sorting a discrete scale in an encoding field definition. Attributes ---------- - type : enum('rgb', 'cubehelix', 'cubehelix-long') + op : :class:`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. - gamma : float + For a full list of operations, please see the documentation for `aggregate + `__. + field : anyOf(string, :class:`RepeatRef`) + The data `field `__ to sort by. + **Default value:** If unspecified, defaults to the field specified in the outer data + reference. + order : :class:`SortOrder` + The sort order. One of ``"ascending"`` (default), ``"descending"``, or ``null`` (no + not sort). """ - _schema = {'$ref': '#/definitions/ScaleInterpolateParams'} + _schema = {'$ref': '#/definitions/EncodingSortField'} _rootschema = Root._schema - def __init__(self, type=Undefined, gamma=Undefined, **kwds): - super(ScaleInterpolateParams, self).__init__(type=type, gamma=gamma, **kwds) + def __init__(self, op=Undefined, field=Undefined, order=Undefined, **kwds): + super(EncodingSortField, self).__init__(op=op, field=field, order=order, **kwds) -class ScaleResolveMap(VegaLiteSchema): - """ScaleResolveMap schema wrapper +class SortField(VegaLiteSchema): + """SortField schema wrapper - Mapping(required=[]) + Mapping(required=[field]) + A sort definition for transform Attributes ---------- - color : :class:`ResolveMode` - - fill : :class:`ResolveMode` - - opacity : :class:`ResolveMode` - - shape : :class:`ResolveMode` - - size : :class:`ResolveMode` + field : string + The name of the field to sort. + order : :class:`VgComparatorOrder` + Whether to sort the field in ascending or descending order. + """ + _schema = {'$ref': '#/definitions/SortField'} + _rootschema = Root._schema - stroke : :class:`ResolveMode` + def __init__(self, field=Undefined, order=Undefined, **kwds): + super(SortField, self).__init__(field=field, order=order, **kwds) - x : :class:`ResolveMode` - y : :class:`ResolveMode` +class SortOrder(Sort): + """SortOrder schema wrapper + anyOf(:class:`VgComparatorOrder`, None) """ - _schema = {'$ref': '#/definitions/ScaleResolveMap'} + _schema = {'$ref': '#/definitions/SortOrder'} _rootschema = Root._schema - def __init__(self, color=Undefined, fill=Undefined, opacity=Undefined, shape=Undefined, - size=Undefined, stroke=Undefined, x=Undefined, y=Undefined, **kwds): - super(ScaleResolveMap, self).__init__(color=color, fill=fill, opacity=opacity, shape=shape, - size=size, stroke=stroke, x=x, y=y, **kwds) + def __init__(self, *args, **kwds): + super(SortOrder, self).__init__(*args, **kwds) -class ScaleType(VegaLiteSchema): - """ScaleType schema wrapper +class Spec(VegaLiteSchema): + """Spec schema wrapper - enum('linear', 'bin-linear', 'log', 'pow', 'sqrt', 'time', 'utc', 'sequential', 'ordinal', - 'bin-ordinal', 'point', 'band') + anyOf(:class:`CompositeUnitSpec`, :class:`LayerSpec`, :class:`FacetSpec`, + :class:`RepeatSpec`, :class:`VConcatSpec`, :class:`HConcatSpec`) """ - _schema = {'$ref': '#/definitions/ScaleType'} + _schema = {'$ref': '#/definitions/Spec'} _rootschema = Root._schema - def __init__(self, *args): - super(ScaleType, self).__init__(*args) + def __init__(self, *args, **kwds): + super(Spec, self).__init__(*args, **kwds) -class SchemeParams(VegaLiteSchema): - """SchemeParams schema wrapper +class CompositeUnitSpec(Spec): + """CompositeUnitSpec schema wrapper - Mapping(required=[name]) + Mapping(required=[mark]) Attributes ---------- - name : string - A color scheme name for sequential/ordinal scales (e.g., ``"category10"`` or - ``"viridis"`` ). + mark : :class:`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 : :class:`Data` + An object describing the data source + description : string + Description of this mark for commenting purpose. + encoding : :class:`Encoding` + A key-value mapping between encoding channels and definition of fields. + height : float + The height of a visualization. - 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. - """ - _schema = {'$ref': '#/definitions/SchemeParams'} - _rootschema = Root._schema + **Default value:** - def __init__(self, name=Undefined, extent=Undefined, **kwds): - super(SchemeParams, self).__init__(name=name, extent=extent, **kwds) + * 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`` is ``null``, the height will be the value of `config.view.height + `__. + * If no field is mapped to ``y`` channel, the ``height`` will be the value of + ``rangeStep``. -class SelectionConfig(VegaLiteSchema): - """SelectionConfig schema wrapper + **Note** : For plots with `row and column channels + `__, this represents the + height of a single view. - Mapping(required=[]) + **See also:** The documentation for `width and height + `__ contains more examples. + name : string + Name of the visualization for later reference. + projection : :class:`Projection` + An object defining properties of geographic projection, which will be applied to + ``shape`` path for ``"geoshape"`` marks + and to ``latitude`` and ``"longitude"`` channels for other marks. + selection : Mapping(required=[]) + A key-value mapping between selection names and definitions. + title : anyOf(string, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`Transform`) + An array of data transformations such as filter and new field calculation. + width : float + The width of a visualization. - Attributes - ---------- + **Default value:** This will be determined by the following rules: - interval : :class:`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 : :class:`MultiSelectionConfig` - The default definition for a `multi - `__ selection. All - properties and transformations - for a multi selection definition (except ``type`` ) may be specified here. + * 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`` is ``null``, the width will be the value of `config.view.width + `__. + * If no field is mapped to ``x`` channel, the ``width`` will be the value of + `config.scale.textXRangeStep + `__ for + ``text`` mark and the value of ``rangeStep`` for other marks. - For instance, setting ``multi`` to ``{"toggle": "event.altKey"}`` adds additional - values to - multi selections when clicking with the alt-key pressed by default. - single : :class:`SingleSelectionConfig` - The default definition for a `single - `__ selection. All - properties and transformations - for a single selection definition (except ``type`` ) may be specified here. + **Note:** For plots with `row and column channels + `__, this represents the + width of a single view. - For instance, setting ``single`` to ``{"on": "dblclick"}`` populates single - selections on double-click by default. + **See also:** The documentation for `width and height + `__ contains more examples. """ - _schema = {'$ref': '#/definitions/SelectionConfig'} + _schema = {'$ref': '#/definitions/CompositeUnitSpec'} _rootschema = Root._schema - def __init__(self, interval=Undefined, multi=Undefined, single=Undefined, **kwds): - super(SelectionConfig, self).__init__(interval=interval, multi=multi, single=single, **kwds) + def __init__(self, mark=Undefined, data=Undefined, description=Undefined, encoding=Undefined, + height=Undefined, name=Undefined, projection=Undefined, selection=Undefined, + title=Undefined, transform=Undefined, width=Undefined, **kwds): + super(CompositeUnitSpec, self).__init__(mark=mark, data=data, description=description, + encoding=encoding, height=height, name=name, + projection=projection, selection=selection, title=title, + transform=transform, width=width, **kwds) -class SelectionDef(VegaLiteSchema): - """SelectionDef schema wrapper +class FacetSpec(Spec): + """FacetSpec schema wrapper - anyOf(:class:`SingleSelection`, :class:`MultiSelection`, :class:`IntervalSelection`) - """ - _schema = {'$ref': '#/definitions/SelectionDef'} - _rootschema = Root._schema + Mapping(required=[facet, spec]) - def __init__(self, *args, **kwds): - super(SelectionDef, self).__init__(*args, **kwds) + Attributes + ---------- + facet : :class:`FacetMapping` + An object that describes mappings between ``row`` and ``column`` channels and their + field definitions. + spec : anyOf(:class:`LayerSpec`, :class:`CompositeUnitSpec`) + A specification of the view that gets faceted. + align : anyOf(:class:`VgLayoutAlign`, :class:`RowColVgLayoutAlign`) + The alignment to apply to grid rows and columns. + The supported string values are ``"all"``, ``"each"``, and ``"none"``. -class SelectionDomain(VegaLiteSchema): - """SelectionDomain schema wrapper - anyOf(Mapping(required=[selection]), Mapping(required=[selection])) - """ - _schema = {'$ref': '#/definitions/SelectionDomain'} - _rootschema = Root._schema + * 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. - def __init__(self, *args, **kwds): - super(SelectionDomain, self).__init__(*args, **kwds) + Alternatively, an object value of the form ``{"row": string, "column": string}`` can + be 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) or ``flush``. -class SelectionPredicate(VegaLiteSchema): - """SelectionPredicate schema wrapper - Mapping(required=[selection]) + * If set to ``full``, the entire calculated bounds (including axes, title, and + legend) will be used. + * If set to ``flush``, 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. - Attributes - ---------- + **Default value:** ``"full"`` + center : anyOf(boolean, :class:`RowColboolean`) + Boolean flag indicating if subviews should be centered relative to their respective + rows or columns. - selection : :class:`SelectionOperand` - Filter using a selection name. + 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 : :class:`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 : :class:`Resolve` + Scale, axis, and legend resolutions for facets. + spacing : anyOf(float, :class:`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, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`Transform`) + An array of data transformations such as filter and new field calculation. """ - _schema = {'$ref': '#/definitions/SelectionPredicate'} + _schema = {'$ref': '#/definitions/FacetSpec'} _rootschema = Root._schema - def __init__(self, selection=Undefined, **kwds): - super(SelectionPredicate, self).__init__(selection=selection, **kwds) + def __init__(self, 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): + super(FacetSpec, self).__init__(facet=facet, spec=spec, align=align, bounds=bounds, + center=center, data=data, description=description, name=name, + resolve=resolve, spacing=spacing, title=title, + transform=transform, **kwds) -class SelectionResolution(VegaLiteSchema): - """SelectionResolution schema wrapper +class HConcatSpec(Spec): + """HConcatSpec schema wrapper - enum('global', 'union', 'intersect') - """ - _schema = {'$ref': '#/definitions/SelectionResolution'} - _rootschema = Root._schema + Mapping(required=[hconcat]) - def __init__(self, *args): - super(SelectionResolution, self).__init__(*args) + Attributes + ---------- + hconcat : List(:class:`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) or ``flush``. -class SingleDefChannel(VegaLiteSchema): - """SingleDefChannel schema wrapper - enum('x', 'y', 'x2', 'y2', 'longitude', 'latitude', 'longitude2', 'latitude2', 'row', - 'column', 'color', 'fill', 'stroke', 'size', 'shape', 'opacity', 'text', 'tooltip', 'href', - 'key') + * If set to ``full``, the entire calculated bounds (including axes, title, and + legend) will be used. + * If set to ``flush``, 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 : :class:`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 : :class:`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, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`Transform`) + An array of data transformations such as filter and new field calculation. """ - _schema = {'$ref': '#/definitions/SingleDefChannel'} + _schema = {'$ref': '#/definitions/HConcatSpec'} _rootschema = Root._schema - def __init__(self, *args): - super(SingleDefChannel, self).__init__(*args) + def __init__(self, hconcat=Undefined, bounds=Undefined, center=Undefined, data=Undefined, + description=Undefined, name=Undefined, resolve=Undefined, spacing=Undefined, + title=Undefined, transform=Undefined, **kwds): + super(HConcatSpec, self).__init__(hconcat=hconcat, bounds=bounds, center=center, data=data, + description=description, name=name, resolve=resolve, + spacing=spacing, title=title, transform=transform, **kwds) -class SingleSelection(VegaLiteSchema): - """SingleSelection schema wrapper +class LayerSpec(Spec): + """LayerSpec schema wrapper - Mapping(required=[type]) + Mapping(required=[layer]) + Layer Spec with encoding and projection Attributes ---------- - type : enum('single') + layer : List(anyOf(:class:`LayerSpec`, :class:`CompositeUnitSpec`)) + Layer or single view specifications to be layered. - bind : anyOf(:class:`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. + **Note** : Specifications inside ``layer`` cannot use ``row`` and ``column`` + channels as layering facet specifications is not allowed. + data : :class:`Data` + An object describing the data source + description : string + Description of this mark for commenting purpose. + encoding : :class:`Encoding` + A shared key-value mapping between encoding channels and definition of fields in the + underlying layers. + height : float + The height of a visualization. - 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(:class:`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. + **Default value:** - See the `nearest transform `__ - documentation for more information. - on : :class:`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 : :class:`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. - """ - _schema = {'$ref': '#/definitions/SingleSelection'} - _rootschema = Root._schema - def __init__(self, type=Undefined, bind=Undefined, empty=Undefined, encodings=Undefined, - fields=Undefined, nearest=Undefined, on=Undefined, resolve=Undefined, **kwds): - super(SingleSelection, self).__init__(type=type, bind=bind, empty=empty, encodings=encodings, - fields=fields, nearest=nearest, on=on, resolve=resolve, - **kwds) + * 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`` is ``null``, the height will be the value of `config.view.height + `__. + * If no field is mapped to ``y`` channel, the ``height`` will be the value of + ``rangeStep``. + **Note** : For plots with `row and column channels + `__, this represents the + height of a single view. -class SingleSelectionConfig(VegaLiteSchema): - """SingleSelectionConfig schema wrapper + **See also:** The documentation for `width and height + `__ contains more examples. + name : string + Name of the visualization for later reference. + projection : :class:`Projection` + An object defining properties of the geographic projection shared by underlying + layers. + resolve : :class:`Resolve` + Scale, axis, and legend resolutions for layers. + title : anyOf(string, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`Transform`) + An array of data transformations such as filter and new field calculation. + width : float + The width of a visualization. - Mapping(required=[]) + **Default value:** This will be determined by the following rules: - Attributes - ---------- - bind : anyOf(:class:`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. + * 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`` is ``null``, the width will be the value of `config.view.width + `__. + * If no field is mapped to ``x`` channel, the ``width`` will be the value of + `config.scale.textXRangeStep + `__ for + ``text`` mark and the value of ``rangeStep`` for other marks. - 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(:class:`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. + **Note:** For plots with `row and column channels + `__, this represents the + width of a single view. - See the `nearest transform `__ - documentation for more information. - on : :class:`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 : :class:`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. + **See also:** The documentation for `width and height + `__ contains more examples. """ - _schema = {'$ref': '#/definitions/SingleSelectionConfig'} + _schema = {'$ref': '#/definitions/LayerSpec'} _rootschema = Root._schema - def __init__(self, bind=Undefined, empty=Undefined, encodings=Undefined, fields=Undefined, - nearest=Undefined, on=Undefined, resolve=Undefined, **kwds): - super(SingleSelectionConfig, self).__init__(bind=bind, empty=empty, encodings=encodings, - fields=fields, nearest=nearest, on=on, - resolve=resolve, **kwds) - + def __init__(self, layer=Undefined, data=Undefined, description=Undefined, encoding=Undefined, + height=Undefined, name=Undefined, projection=Undefined, resolve=Undefined, + title=Undefined, transform=Undefined, width=Undefined, **kwds): + super(LayerSpec, self).__init__(layer=layer, data=data, description=description, + encoding=encoding, height=height, name=name, + projection=projection, resolve=resolve, title=title, + transform=transform, width=width, **kwds) -class SingleTimeUnit(VegaLiteSchema): - """SingleTimeUnit schema wrapper - anyOf(:class:`LocalSingleTimeUnit`, :class:`UtcSingleTimeUnit`) - """ - _schema = {'$ref': '#/definitions/SingleTimeUnit'} - _rootschema = Root._schema +class RepeatSpec(Spec): + """RepeatSpec schema wrapper - def __init__(self, *args, **kwds): - super(SingleTimeUnit, self).__init__(*args, **kwds) + Mapping(required=[repeat, spec]) + Attributes + ---------- -class Sort(VegaLiteSchema): - """Sort schema wrapper + repeat : :class:`Repeat` + An object that describes what fields should be repeated into views that are laid out + as a ``row`` or ``column``. + spec : :class:`Spec` - anyOf(List(float), List(string), List(boolean), List(:class:`DateTime`), :class:`SortOrder`, - :class:`EncodingSortField`, None) - """ - _schema = {'$ref': '#/definitions/Sort'} - _rootschema = Root._schema + align : anyOf(:class:`VgLayoutAlign`, :class:`RowColVgLayoutAlign`) + The alignment to apply to grid rows and columns. + The supported string values are ``"all"``, ``"each"``, and ``"none"``. - def __init__(self, *args, **kwds): - super(Sort, self).__init__(*args, **kwds) + * 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. -class SortField(VegaLiteSchema): - """SortField schema wrapper + Alternatively, an object value of the form ``{"row": string, "column": string}`` can + be used to supply different alignments for rows and columns. - Mapping(required=[field]) - A sort definition for transform + **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) or ``flush``. - Attributes - ---------- - field : string - The name of the field to sort. - order : :class:`VgComparatorOrder` - Whether to sort the field in ascending or descending order. - """ - _schema = {'$ref': '#/definitions/SortField'} - _rootschema = Root._schema + * If set to ``full``, the entire calculated bounds (including axes, title, and + legend) will be used. + * If set to ``flush``, 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. - def __init__(self, field=Undefined, order=Undefined, **kwds): - super(SortField, self).__init__(field=field, order=order, **kwds) + **Default value:** ``"full"`` + center : anyOf(boolean, :class:`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. -class SortOrder(VegaLiteSchema): - """SortOrder schema wrapper + **Default value:** ``false`` + data : :class:`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 : :class:`Resolve` + Scale and legend resolutions for repeated charts. + spacing : anyOf(float, :class:`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. - anyOf(:class:`VgComparatorOrder`, None) + **Default value** : ``10`` + title : anyOf(string, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`Transform`) + An array of data transformations such as filter and new field calculation. """ - _schema = {'$ref': '#/definitions/SortOrder'} + _schema = {'$ref': '#/definitions/RepeatSpec'} _rootschema = Root._schema - def __init__(self, *args, **kwds): - super(SortOrder, self).__init__(*args, **kwds) + def __init__(self, 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): + super(RepeatSpec, self).__init__(repeat=repeat, spec=spec, align=align, bounds=bounds, + center=center, data=data, description=description, name=name, + resolve=resolve, spacing=spacing, title=title, + transform=transform, **kwds) class StackOffset(VegaLiteSchema): @@ -7394,6 +7058,18 @@ def __init__(self, *args, **kwds): super(TextBaseline, self).__init__(*args, **kwds) +class Baseline(TextBaseline): + """Baseline schema wrapper + + enum('top', 'middle', 'bottom') + """ + _schema = {'$ref': '#/definitions/Baseline'} + _rootschema = Root._schema + + def __init__(self, *args): + super(Baseline, self).__init__(*args) + + class TextConfig(VegaLiteSchema): """TextConfig schema wrapper @@ -7601,10 +7277,89 @@ def __init__(self, align=Undefined, angle=Undefined, baseline=Undefined, color=U theta=theta, tooltip=tooltip, **kwds) -class TextFieldDef(VegaLiteSchema): - """TextFieldDef schema wrapper +class TextFieldDef(VegaLiteSchema): + """TextFieldDef schema wrapper + + Mapping(required=[type]) + + Attributes + ---------- + + type : :class:`Type` + The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, + ``"ordinal"``, or ``"nominal"`` ). + It can also be a ``"geojson"`` type for encoding `'geoshape' + `__. + aggregate : :class:`Aggregate` + Aggregation function for the field + (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). + + **Default value:** ``undefined`` (None) + bin : anyOf(boolean, :class:`BinParams`) + A flag for binning a ``quantitative`` field, or `an object defining binning + parameters `__. + If ``true``, default `binning parameters + `__ will be applied. + + **Default value:** ``false`` + field : anyOf(string, :class:`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 if ``aggregate`` is ``count``. + format : string + The `formatting pattern `__ for a + text field. If not defined, this will be determined automatically. + timeUnit : :class:`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`` and ``timeUnit`` ). 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 legend ``title`` are + defined, axis/header/legend title will be used. + """ + _schema = {'$ref': '#/definitions/TextFieldDef'} + _rootschema = Root._schema + + def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, + format=Undefined, timeUnit=Undefined, title=Undefined, **kwds): + super(TextFieldDef, self).__init__(type=type, aggregate=aggregate, bin=bin, field=field, + format=format, timeUnit=timeUnit, title=title, **kwds) + + +class TextFieldDefWithCondition(VegaLiteSchema): + """TextFieldDefWithCondition schema wrapper Mapping(required=[type]) + A FieldDef with Condition :raw-html:`` Attributes ---------- @@ -7626,6 +7381,12 @@ class TextFieldDef(VegaLiteSchema): `__ will be applied. **Default value:** ``false`` + condition : anyOf(:class:`ConditionalValueDef`, List(:class:`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, :class:`RepeatRef`) **Required.** A string defining the name of the field from which to pull a data value @@ -7670,13 +7431,36 @@ class TextFieldDef(VegaLiteSchema): 2) If both field definition's ``title`` and axis, header, or legend ``title`` are defined, axis/header/legend title will be used. """ - _schema = {'$ref': '#/definitions/TextFieldDef'} + _schema = {'$ref': '#/definitions/TextFieldDefWithCondition'} _rootschema = Root._schema - def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, - format=Undefined, timeUnit=Undefined, title=Undefined, **kwds): - super(TextFieldDef, self).__init__(type=type, aggregate=aggregate, bin=bin, field=field, - format=format, timeUnit=timeUnit, title=title, **kwds) + def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, + field=Undefined, format=Undefined, timeUnit=Undefined, title=Undefined, **kwds): + super(TextFieldDefWithCondition, self).__init__(type=type, aggregate=aggregate, bin=bin, + condition=condition, field=field, format=format, + timeUnit=timeUnit, title=title, **kwds) + + +class TextValueDefWithCondition(VegaLiteSchema): + """TextValueDefWithCondition schema wrapper + + Mapping(required=[]) + A ValueDef with Condition + + Attributes + ---------- + + condition : anyOf(:class:`ConditionalTextFieldDef`, :class:`ConditionalValueDef`, + List(:class:`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. + """ + _schema = {'$ref': '#/definitions/TextValueDefWithCondition'} + _rootschema = Root._schema + + def __init__(self, condition=Undefined, value=Undefined, **kwds): + super(TextValueDefWithCondition, self).__init__(condition=condition, value=value, **kwds) class TickConfig(VegaLiteSchema): @@ -7904,26 +7688,55 @@ def __init__(self, *args, **kwds): super(TimeUnit, self).__init__(*args, **kwds) -class TimeUnitTransform(VegaLiteSchema): - """TimeUnitTransform schema wrapper +class MultiTimeUnit(TimeUnit): + """MultiTimeUnit schema wrapper - Mapping(required=[timeUnit, field, as]) + anyOf(:class:`LocalMultiTimeUnit`, :class:`UtcMultiTimeUnit`) + """ + _schema = {'$ref': '#/definitions/MultiTimeUnit'} + _rootschema = Root._schema - Attributes - ---------- + def __init__(self, *args, **kwds): + super(MultiTimeUnit, self).__init__(*args, **kwds) - field : string - The data field to apply time unit. - timeUnit : :class:`TimeUnit` - The timeUnit. - as : string - The output field to write the timeUnit value. + +class LocalMultiTimeUnit(MultiTimeUnit): + """LocalMultiTimeUnit schema wrapper + + enum('yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', + 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'quartermonth', + 'monthdate', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds') """ - _schema = {'$ref': '#/definitions/TimeUnitTransform'} + _schema = {'$ref': '#/definitions/LocalMultiTimeUnit'} _rootschema = Root._schema - def __init__(self, field=Undefined, timeUnit=Undefined, **kwds): - super(TimeUnitTransform, self).__init__(field=field, timeUnit=timeUnit, **kwds) + def __init__(self, *args): + super(LocalMultiTimeUnit, self).__init__(*args) + + +class SingleTimeUnit(TimeUnit): + """SingleTimeUnit schema wrapper + + anyOf(:class:`LocalSingleTimeUnit`, :class:`UtcSingleTimeUnit`) + """ + _schema = {'$ref': '#/definitions/SingleTimeUnit'} + _rootschema = Root._schema + + def __init__(self, *args, **kwds): + super(SingleTimeUnit, self).__init__(*args, **kwds) + + +class LocalSingleTimeUnit(SingleTimeUnit): + """LocalSingleTimeUnit schema wrapper + + enum('year', 'quarter', 'month', 'day', 'date', 'hours', 'minutes', 'seconds', + 'milliseconds') + """ + _schema = {'$ref': '#/definitions/LocalSingleTimeUnit'} + _rootschema = Root._schema + + def __init__(self, *args): + super(LocalSingleTimeUnit, self).__init__(*args) class TitleOrient(VegaLiteSchema): @@ -7984,19 +7797,52 @@ def __init__(self, text=Undefined, anchor=Undefined, offset=Undefined, orient=Un style=style, **kwds) -class TopLevelLayerSpec(VegaLiteSchema): - """TopLevelLayerSpec schema wrapper +class TopLevelSpec(VegaLiteSchema): + """TopLevelSpec schema wrapper - Mapping(required=[layer]) + anyOf(:class:`TopLevelFacetedUnitSpec`, :class:`TopLevelFacetSpec`, + :class:`TopLevelLayerSpec`, :class:`TopLevelRepeatSpec`, :class:`TopLevelVConcatSpec`, + :class:`TopLevelHConcatSpec`) + """ + _schema = {'$ref': '#/definitions/TopLevelSpec'} + _rootschema = Root._schema + + def __init__(self, *args, **kwds): + super(TopLevelSpec, self).__init__(*args, **kwds) + + +class TopLevelFacetSpec(TopLevelSpec): + """TopLevelFacetSpec schema wrapper + + Mapping(required=[data, facet, spec]) Attributes ---------- - layer : List(anyOf(:class:`LayerSpec`, :class:`CompositeUnitSpec`)) - Layer or single view specifications to be layered. + data : :class:`Data` + An object describing the data source + facet : :class:`FacetMapping` + An object that describes mappings between ``row`` and ``column`` channels and their + field definitions. + spec : anyOf(:class:`LayerSpec`, :class:`CompositeUnitSpec`) + A specification of the view that gets faceted. + align : anyOf(:class:`VgLayoutAlign`, :class:`RowColVgLayoutAlign`) + The alignment to apply to grid rows and columns. + The supported string values are ``"all"``, ``"each"``, and ``"none"``. - **Note** : Specifications inside ``layer`` cannot use ``row`` and ``column`` - channels as layering facet specifications is not allowed. + + * 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}`` can + be used to supply different alignments for rows and columns. + + **Default value:** ``"all"``. autosize : anyOf(:class:`AutosizeType`, :class:`AutoSizeParams`) Sets how the visualization size should be determined. If a string, should be one of ``"pad"``, ``"fit"`` or ``"none"``. @@ -8010,11 +7856,111 @@ class TopLevelLayerSpec(VegaLiteSchema): 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) or ``flush``. + + + * If set to ``full``, the entire calculated bounds (including axes, title, and + legend) will be used. + * If set to ``flush``, 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, :class:`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`` config : :class:`Config` Vega-Lite configuration object. This property can only be defined at the top-level of a specification. + datasets : :class:`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 : :class:`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 : :class:`Resolve` + Scale, axis, and legend resolutions for facets. + spacing : anyOf(float, :class:`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, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`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. + """ + _schema = {'$ref': '#/definitions/TopLevelFacetSpec'} + _rootschema = Root._schema + + def __init__(self, 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): + super(TopLevelFacetSpec, self).__init__(data=data, facet=facet, spec=spec, align=align, + autosize=autosize, background=background, bounds=bounds, + center=center, config=config, datasets=datasets, + description=description, name=name, padding=padding, + resolve=resolve, spacing=spacing, title=title, + transform=transform, **kwds) + + +class TopLevelFacetedUnitSpec(TopLevelSpec): + """TopLevelFacetedUnitSpec schema wrapper + + Mapping(required=[data, mark]) + + Attributes + ---------- + data : :class:`Data` An object describing the data source + mark : :class:`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(:class:`AutosizeType`, :class:`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 : :class:`Config` + Vega-Lite configuration object. This property can only be defined at the top-level + of a specification. datasets : :class:`Datasets` A global data store for named datasets. This is a mapping from names to inline datasets. @@ -8022,9 +7968,8 @@ class TopLevelLayerSpec(VegaLiteSchema): values are ingested as objects with a ``data`` property. description : string Description of this mark for commenting purpose. - encoding : :class:`Encoding` - A shared key-value mapping between encoding channels and definition of fields in the - underlying layers. + encoding : :class:`EncodingWithFacet` + A key-value mapping between encoding channels and definition of fields. height : float The height of a visualization. @@ -8060,13 +8005,14 @@ class TopLevelLayerSpec(VegaLiteSchema): 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 : :class:`Projection` - An object defining properties of the geographic projection shared by underlying - layers. - resolve : :class:`Resolve` - Scale, axis, and legend resolutions for layers. + + **Default value** : ``5`` + projection : :class:`Projection` + An object defining properties of geographic projection, which will be applied to + ``shape`` path for ``"geoshape"`` marks + and to ``latitude`` and ``"longitude"`` channels for other marks. + selection : Mapping(required=[]) + A key-value mapping between selection names and definitions. title : anyOf(string, :class:`TitleParams`) Title for the plot. transform : List(:class:`Transform`) @@ -8108,22 +8054,23 @@ class TopLevelLayerSpec(VegaLiteSchema): property allows automatic validation and autocomplete in editors that support JSON schema. """ - _schema = {'$ref': '#/definitions/TopLevelLayerSpec'} + _schema = {'$ref': '#/definitions/TopLevelFacetedUnitSpec'} _rootschema = Root._schema - def __init__(self, layer=Undefined, autosize=Undefined, background=Undefined, config=Undefined, - data=Undefined, datasets=Undefined, description=Undefined, encoding=Undefined, + def __init__(self, data=Undefined, mark=Undefined, autosize=Undefined, background=Undefined, + config=Undefined, datasets=Undefined, description=Undefined, encoding=Undefined, height=Undefined, name=Undefined, padding=Undefined, projection=Undefined, - resolve=Undefined, title=Undefined, transform=Undefined, width=Undefined, **kwds): - super(TopLevelLayerSpec, self).__init__(layer=layer, autosize=autosize, background=background, - config=config, data=data, datasets=datasets, - description=description, encoding=encoding, - height=height, name=name, padding=padding, - projection=projection, resolve=resolve, title=title, - transform=transform, width=width, **kwds) + selection=Undefined, title=Undefined, transform=Undefined, width=Undefined, **kwds): + super(TopLevelFacetedUnitSpec, self).__init__(data=data, mark=mark, autosize=autosize, + background=background, config=config, + datasets=datasets, description=description, + encoding=encoding, height=height, name=name, + padding=padding, projection=projection, + selection=selection, title=title, + transform=transform, width=width, **kwds) -class TopLevelHConcatSpec(VegaLiteSchema): +class TopLevelHConcatSpec(TopLevelSpec): """TopLevelHConcatSpec schema wrapper Mapping(required=[hconcat]) @@ -8216,36 +8163,19 @@ def __init__(self, hconcat=Undefined, autosize=Undefined, background=Undefined, transform=transform, **kwds) -class TopLevelRepeatSpec(VegaLiteSchema): - """TopLevelRepeatSpec schema wrapper +class TopLevelLayerSpec(TopLevelSpec): + """TopLevelLayerSpec schema wrapper - Mapping(required=[repeat, spec]) + Mapping(required=[layer]) Attributes ---------- - repeat : :class:`Repeat` - An object that describes what fields should be repeated into views that are laid out - as a ``row`` or ``column``. - spec : :class:`Spec` - - align : anyOf(:class:`VgLayoutAlign`, :class:`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}`` can - be used to supply different alignments for rows and columns. + layer : List(anyOf(:class:`LayerSpec`, :class:`CompositeUnitSpec`)) + Layer or single view specifications to be layered. - **Default value:** ``"all"``. + **Note** : Specifications inside ``layer`` cannot use ``row`` and ``column`` + channels as layering facet specifications is not allowed. autosize : anyOf(:class:`AutosizeType`, :class:`AutoSizeParams`) Sets how the visualization size should be determined. If a string, should be one of ``"pad"``, ``"fit"`` or ``"none"``. @@ -8259,26 +8189,6 @@ class TopLevelRepeatSpec(VegaLiteSchema): 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) or ``flush``. - - - * If set to ``full``, the entire calculated bounds (including axes, title, and - legend) will be used. - * If set to ``flush``, 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, :class:`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`` config : :class:`Config` Vega-Lite configuration object. This property can only be defined at the top-level of a specification. @@ -8291,6 +8201,37 @@ class TopLevelRepeatSpec(VegaLiteSchema): values are ingested as objects with a ``data`` property. description : string Description of this mark for commenting purpose. + encoding : :class:`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`` is ``null``, the height will be the value of `config.view.height + `__. + * If no field is mapped to ``y`` channel, the ``height`` will be the value of + ``rangeStep``. + + **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. name : string Name of the visualization for later reference. padding : :class:`Padding` @@ -8300,18 +8241,45 @@ class TopLevelRepeatSpec(VegaLiteSchema): "bottom": 5}`` to specify padding for each side of the visualization. **Default value** : ``5`` + projection : :class:`Projection` + An object defining properties of the geographic projection shared by underlying + layers. resolve : :class:`Resolve` - Scale and legend resolutions for repeated charts. - spacing : anyOf(float, :class:`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`` + Scale, axis, and legend resolutions for layers. title : anyOf(string, :class:`TitleParams`) Title for the plot. transform : List(:class:`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`` is ``null``, the width will be the value of `config.view.width + `__. + * If no field is mapped to ``x`` channel, the ``width`` will be the value of + `config.scale.textXRangeStep + `__ for + ``text`` mark and the value of ``rangeStep`` 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. $schema : string URL to `JSON schema `__ for a Vega-Lite specification. Unless you have a reason to change this, use @@ -8319,32 +8287,51 @@ class TopLevelRepeatSpec(VegaLiteSchema): property allows automatic validation and autocomplete in editors that support JSON schema. """ - _schema = {'$ref': '#/definitions/TopLevelRepeatSpec'} + _schema = {'$ref': '#/definitions/TopLevelLayerSpec'} _rootschema = Root._schema - def __init__(self, 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): - super(TopLevelRepeatSpec, self).__init__(repeat=repeat, spec=spec, align=align, - autosize=autosize, background=background, - bounds=bounds, center=center, config=config, data=data, - datasets=datasets, description=description, name=name, - padding=padding, resolve=resolve, spacing=spacing, - title=title, transform=transform, **kwds) + def __init__(self, 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): + super(TopLevelLayerSpec, self).__init__(layer=layer, autosize=autosize, background=background, + config=config, data=data, datasets=datasets, + description=description, encoding=encoding, + height=height, name=name, padding=padding, + projection=projection, resolve=resolve, title=title, + transform=transform, width=width, **kwds) -class TopLevelVConcatSpec(VegaLiteSchema): - """TopLevelVConcatSpec schema wrapper +class TopLevelRepeatSpec(TopLevelSpec): + """TopLevelRepeatSpec schema wrapper - Mapping(required=[vconcat]) + Mapping(required=[repeat, spec]) Attributes ---------- - vconcat : List(:class:`Spec`) - A list of views that should be concatenated and put into a column. + repeat : :class:`Repeat` + An object that describes what fields should be repeated into views that are laid out + as a ``row`` or ``column``. + spec : :class:`Spec` + + align : anyOf(:class:`VgLayoutAlign`, :class:`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}`` can + be used to supply different alignments for rows and columns. + + **Default value:** ``"all"``. autosize : anyOf(:class:`AutosizeType`, :class:`AutoSizeParams`) Sets how the visualization size should be determined. If a string, should be one of ``"pad"``, ``"fit"`` or ``"none"``. @@ -8370,10 +8357,13 @@ class TopLevelVConcatSpec(VegaLiteSchema): sub-plots without axes or legends into a uniform grid structure. **Default value:** ``"full"`` - center : boolean + center : anyOf(boolean, :class:`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`` config : :class:`Config` Vega-Lite configuration object. This property can only be defined at the top-level @@ -8397,9 +8387,11 @@ class TopLevelVConcatSpec(VegaLiteSchema): **Default value** : ``5`` resolve : :class:`Resolve` - Scale, axis, and legend resolutions for vertically concatenated charts. - spacing : float - The spacing in pixels between sub-views of the concat operator. + Scale and legend resolutions for repeated charts. + spacing : anyOf(float, :class:`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, :class:`TitleParams`) @@ -8413,53 +8405,32 @@ class TopLevelVConcatSpec(VegaLiteSchema): property allows automatic validation and autocomplete in editors that support JSON schema. """ - _schema = {'$ref': '#/definitions/TopLevelVConcatSpec'} + _schema = {'$ref': '#/definitions/TopLevelRepeatSpec'} _rootschema = Root._schema - def __init__(self, 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): - super(TopLevelVConcatSpec, self).__init__(vconcat=vconcat, autosize=autosize, - background=background, bounds=bounds, center=center, - config=config, data=data, datasets=datasets, - description=description, name=name, padding=padding, - resolve=resolve, spacing=spacing, title=title, - transform=transform, **kwds) - - -class TopLevelFacetSpec(VegaLiteSchema): - """TopLevelFacetSpec schema wrapper - - Mapping(required=[data, facet, spec]) - - Attributes - ---------- - - data : :class:`Data` - An object describing the data source - facet : :class:`FacetMapping` - An object that describes mappings between ``row`` and ``column`` channels and their - field definitions. - spec : anyOf(:class:`LayerSpec`, :class:`CompositeUnitSpec`) - A specification of the view that gets faceted. - align : anyOf(:class:`VgLayoutAlign`, :class:`RowColVgLayoutAlign`) - The alignment to apply to grid rows and columns. - The supported string values are ``"all"``, ``"each"``, and ``"none"``. + def __init__(self, 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): + super(TopLevelRepeatSpec, self).__init__(repeat=repeat, spec=spec, align=align, + autosize=autosize, background=background, + bounds=bounds, center=center, config=config, data=data, + datasets=datasets, description=description, name=name, + padding=padding, resolve=resolve, spacing=spacing, + title=title, transform=transform, **kwds) - * 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. +class TopLevelVConcatSpec(TopLevelSpec): + """TopLevelVConcatSpec schema wrapper - Alternatively, an object value of the form ``{"row": string, "column": string}`` can - be used to supply different alignments for rows and columns. + Mapping(required=[vconcat]) - **Default value:** ``"all"``. + Attributes + ---------- + + vconcat : List(:class:`Spec`) + A list of views that should be concatenated and put into a column. autosize : anyOf(:class:`AutosizeType`, :class:`AutoSizeParams`) Sets how the visualization size should be determined. If a string, should be one of ``"pad"``, ``"fit"`` or ``"none"``. @@ -8485,17 +8456,16 @@ class TopLevelFacetSpec(VegaLiteSchema): sub-plots without axes or legends into a uniform grid structure. **Default value:** ``"full"`` - center : anyOf(boolean, :class:`RowColboolean`) + center : boolean 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`` config : :class:`Config` Vega-Lite configuration object. This property can only be defined at the top-level of a specification. + data : :class:`Data` + An object describing the data source datasets : :class:`Datasets` A global data store for named datasets. This is a mapping from names to inline datasets. @@ -8513,11 +8483,9 @@ class TopLevelFacetSpec(VegaLiteSchema): **Default value** : ``5`` resolve : :class:`Resolve` - Scale, axis, and legend resolutions for facets. - spacing : anyOf(float, :class:`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. + 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, :class:`TitleParams`) @@ -8531,241 +8499,238 @@ class TopLevelFacetSpec(VegaLiteSchema): property allows automatic validation and autocomplete in editors that support JSON schema. """ - _schema = {'$ref': '#/definitions/TopLevelFacetSpec'} + _schema = {'$ref': '#/definitions/TopLevelVConcatSpec'} _rootschema = Root._schema - def __init__(self, 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): - super(TopLevelFacetSpec, self).__init__(data=data, facet=facet, spec=spec, align=align, - autosize=autosize, background=background, bounds=bounds, - center=center, config=config, datasets=datasets, - description=description, name=name, padding=padding, - resolve=resolve, spacing=spacing, title=title, - transform=transform, **kwds) + def __init__(self, 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): + super(TopLevelVConcatSpec, self).__init__(vconcat=vconcat, autosize=autosize, + background=background, bounds=bounds, center=center, + config=config, data=data, datasets=datasets, + description=description, name=name, padding=padding, + resolve=resolve, spacing=spacing, title=title, + transform=transform, **kwds) -class TopLevelFacetedUnitSpec(VegaLiteSchema): - """TopLevelFacetedUnitSpec schema wrapper +class TopoDataFormat(DataFormat): + """TopoDataFormat schema wrapper - Mapping(required=[data, mark]) + Mapping(required=[]) Attributes ---------- - data : :class:`Data` - An object describing the data source - mark : :class:`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(:class:`AutosizeType`, :class:`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``. + 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 the ``feature`` 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'), :class:`Parse`, None) + If set to ``"auto"`` (the default), perform automatic type inference to determine + the desired data types. + If set to ``null``, 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 the ``modified_on`` field + in each input record a Date value. - **Default value** : ``pad`` - background : string - CSS color property to use as the background of visualization. + 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. + """ + _schema = {'$ref': '#/definitions/TopoDataFormat'} + _rootschema = Root._schema - **Default value:** none (transparent) - config : :class:`Config` - Vega-Lite configuration object. This property can only be defined at the top-level - of a specification. - datasets : :class:`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 : :class:`EncodingWithFacet` - A key-value mapping between encoding channels and definition of fields. - height : float - The height of a visualization. + def __init__(self, feature=Undefined, mesh=Undefined, parse=Undefined, type=Undefined, **kwds): + super(TopoDataFormat, self).__init__(feature=feature, mesh=mesh, parse=parse, type=type, **kwds) - **Default value:** +class Transform(VegaLiteSchema): + """Transform schema wrapper - * 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`` is ``null``, the height will be the value of `config.view.height - `__. - * If no field is mapped to ``y`` channel, the ``height`` will be the value of - ``rangeStep``. + anyOf(:class:`FilterTransform`, :class:`CalculateTransform`, :class:`LookupTransform`, + :class:`BinTransform`, :class:`TimeUnitTransform`, :class:`AggregateTransform`, + :class:`WindowTransform`) + """ + _schema = {'$ref': '#/definitions/Transform'} + _rootschema = Root._schema - **Note** : For plots with `row and column channels - `__, this represents the - height of a single view. + def __init__(self, *args, **kwds): + super(Transform, self).__init__(*args, **kwds) - **See also:** The documentation for `width and height - `__ contains more examples. - name : string - Name of the visualization for later reference. - padding : :class:`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 : :class:`Projection` - An object defining properties of geographic projection, which will be applied to - ``shape`` path for ``"geoshape"`` marks - and to ``latitude`` and ``"longitude"`` channels for other marks. - selection : Mapping(required=[]) - A key-value mapping between selection names and definitions. - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`Transform`) - An array of data transformations such as filter and new field calculation. - width : float - The width of a visualization. +class AggregateTransform(Transform): + """AggregateTransform schema wrapper - **Default value:** This will be determined by the following rules: + Mapping(required=[aggregate]) + Attributes + ---------- - * 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`` is ``null``, the width will be the value of `config.view.width - `__. - * If no field is mapped to ``x`` channel, the ``width`` will be the value of - `config.scale.textXRangeStep - `__ for - ``text`` mark and the value of ``rangeStep`` for other marks. + aggregate : List(:class:`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. + """ + _schema = {'$ref': '#/definitions/AggregateTransform'} + _rootschema = Root._schema - **Note:** For plots with `row and column channels - `__, this represents the - width of a single view. + def __init__(self, aggregate=Undefined, groupby=Undefined, **kwds): + super(AggregateTransform, self).__init__(aggregate=aggregate, groupby=groupby, **kwds) - **See also:** The documentation for `width and height - `__ contains more examples. - $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 BinTransform(Transform): + """BinTransform schema wrapper + + Mapping(required=[bin, field, as]) + + Attributes + ---------- + + bin : anyOf(boolean, :class:`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. + """ + _schema = {'$ref': '#/definitions/BinTransform'} + _rootschema = Root._schema + + def __init__(self, bin=Undefined, field=Undefined, **kwds): + super(BinTransform, self).__init__(bin=bin, field=field, **kwds) + + +class CalculateTransform(Transform): + """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. """ - _schema = {'$ref': '#/definitions/TopLevelFacetedUnitSpec'} + _schema = {'$ref': '#/definitions/CalculateTransform'} _rootschema = Root._schema - def __init__(self, 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): - super(TopLevelFacetedUnitSpec, self).__init__(data=data, mark=mark, autosize=autosize, - background=background, config=config, - datasets=datasets, description=description, - encoding=encoding, height=height, name=name, - padding=padding, projection=projection, - selection=selection, title=title, - transform=transform, width=width, **kwds) + def __init__(self, calculate=Undefined, **kwds): + super(CalculateTransform, self).__init__(calculate=calculate, **kwds) -class TopLevelSpec(VegaLiteSchema): - """TopLevelSpec schema wrapper +class FilterTransform(Transform): + """FilterTransform schema wrapper - anyOf(:class:`TopLevelFacetedUnitSpec`, :class:`TopLevelFacetSpec`, - :class:`TopLevelLayerSpec`, :class:`TopLevelRepeatSpec`, :class:`TopLevelVConcatSpec`, - :class:`TopLevelHConcatSpec`) + Mapping(required=[filter]) + + Attributes + ---------- + + filter : :class:`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 object + + 2) one of the field predicates: `equal + `__, + `lt `__, + `lte `__, + `gt `__, + `gte `__, + `range `__, + or `oneOf `__. + + 3) a `selection predicate + `__ + + 4) a logical operand that combines (1), (2), or (3). """ - _schema = {'$ref': '#/definitions/TopLevelSpec'} + _schema = {'$ref': '#/definitions/FilterTransform'} _rootschema = Root._schema - def __init__(self, *args, **kwds): - super(TopLevelSpec, self).__init__(*args, **kwds) + def __init__(self, filter=Undefined, **kwds): + super(FilterTransform, self).__init__(filter=filter, **kwds) -class TopoDataFormat(VegaLiteSchema): - """TopoDataFormat schema wrapper +class LookupTransform(Transform): + """LookupTransform schema wrapper - Mapping(required=[]) + Mapping(required=[lookup, from]) 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 the ``feature`` 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'), :class:`Parse`, None) - If set to ``"auto"`` (the default), perform automatic type inference to determine - the desired data types. - If set to ``null``, 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 the ``modified_on`` field - in each input record a Date value. + lookup : string + Key in primary data source. + default : string + The default value to use if lookup fails. - 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. + **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 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 : :class:`LookupData` + Secondary data reference. """ - _schema = {'$ref': '#/definitions/TopoDataFormat'} + _schema = {'$ref': '#/definitions/LookupTransform'} _rootschema = Root._schema - def __init__(self, feature=Undefined, mesh=Undefined, parse=Undefined, type=Undefined, **kwds): - super(TopoDataFormat, self).__init__(feature=feature, mesh=mesh, parse=parse, type=type, **kwds) + def __init__(self, lookup=Undefined, default=Undefined, **kwds): + super(LookupTransform, self).__init__(lookup=lookup, default=default, **kwds) -class Transform(VegaLiteSchema): - """Transform schema wrapper +class TimeUnitTransform(Transform): + """TimeUnitTransform schema wrapper - anyOf(:class:`FilterTransform`, :class:`CalculateTransform`, :class:`LookupTransform`, - :class:`BinTransform`, :class:`TimeUnitTransform`, :class:`AggregateTransform`, - :class:`WindowTransform`) + Mapping(required=[timeUnit, field, as]) + + Attributes + ---------- + + field : string + The data field to apply time unit. + timeUnit : :class:`TimeUnit` + The timeUnit. + as : string + The output field to write the timeUnit value. """ - _schema = {'$ref': '#/definitions/Transform'} + _schema = {'$ref': '#/definitions/TimeUnitTransform'} _rootschema = Root._schema - def __init__(self, *args, **kwds): - super(Transform, self).__init__(*args, **kwds) + def __init__(self, field=Undefined, timeUnit=Undefined, **kwds): + super(TimeUnitTransform, self).__init__(field=field, timeUnit=timeUnit, **kwds) class Type(VegaLiteSchema): @@ -8782,7 +8747,31 @@ def __init__(self, *args, **kwds): super(Type, self).__init__(*args, **kwds) -class UrlData(VegaLiteSchema): +class BasicType(Type): + """BasicType schema wrapper + + enum('quantitative', 'ordinal', 'temporal', 'nominal') + """ + _schema = {'$ref': '#/definitions/BasicType'} + _rootschema = Root._schema + + def __init__(self, *args): + super(BasicType, self).__init__(*args) + + +class GeoType(Type): + """GeoType schema wrapper + + enum('latitude', 'longitude', 'geojson') + """ + _schema = {'$ref': '#/definitions/GeoType'} + _rootschema = Root._schema + + def __init__(self, *args): + super(GeoType, self).__init__(*args) + + +class UrlData(Data): """UrlData schema wrapper Mapping(required=[url]) @@ -8805,7 +8794,7 @@ def __init__(self, url=Undefined, format=Undefined, name=Undefined, **kwds): super(UrlData, self).__init__(url=url, format=format, name=name, **kwds) -class UtcMultiTimeUnit(VegaLiteSchema): +class UtcMultiTimeUnit(MultiTimeUnit): """UtcMultiTimeUnit schema wrapper enum('utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', @@ -8820,7 +8809,7 @@ def __init__(self, *args): super(UtcMultiTimeUnit, self).__init__(*args) -class UtcSingleTimeUnit(VegaLiteSchema): +class UtcSingleTimeUnit(SingleTimeUnit): """UtcSingleTimeUnit schema wrapper enum('utcyear', 'utcquarter', 'utcmonth', 'utcday', 'utcdate', 'utchours', 'utcminutes', @@ -8833,72 +8822,83 @@ def __init__(self, *args): super(UtcSingleTimeUnit, self).__init__(*args) -class ValueDef(VegaLiteSchema): - """ValueDef schema wrapper +class VConcatSpec(Spec): + """VConcatSpec schema wrapper - Mapping(required=[value]) - Definition object for a constant value of an encoding channel. + Mapping(required=[vconcat]) Attributes ---------- - value : anyOf(float, string, boolean) - A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values - between ``0`` to ``1`` for opacity). - """ - _schema = {'$ref': '#/definitions/ValueDef'} - _rootschema = Root._schema - - def __init__(self, value=Undefined, **kwds): - super(ValueDef, self).__init__(value=value, **kwds) + vconcat : List(:class:`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) or ``flush``. -class ValueDefWithCondition(VegaLiteSchema): - """ValueDefWithCondition schema wrapper + * If set to ``full``, the entire calculated bounds (including axes, title, and + legend) will be used. + * If set to ``flush``, 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. - Mapping(required=[]) - A ValueDef with Condition + **Default value:** ``"full"`` + center : boolean + Boolean flag indicating if subviews should be centered relative to their respective + rows or columns. - Attributes - ---------- + **Default value:** ``false`` + data : :class:`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 : :class:`Resolve` + Scale, axis, and legend resolutions for vertically concatenated charts. + spacing : float + The spacing in pixels between sub-views of the concat operator. - condition : anyOf(:class:`ConditionalFieldDef`, :class:`ConditionalValueDef`, - List(:class:`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. + **Default value** : ``10`` + title : anyOf(string, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`Transform`) + An array of data transformations such as filter and new field calculation. """ - _schema = {'$ref': '#/definitions/ValueDefWithCondition'} + _schema = {'$ref': '#/definitions/VConcatSpec'} _rootschema = Root._schema - def __init__(self, condition=Undefined, value=Undefined, **kwds): - super(ValueDefWithCondition, self).__init__(condition=condition, value=value, **kwds) + def __init__(self, vconcat=Undefined, bounds=Undefined, center=Undefined, data=Undefined, + description=Undefined, name=Undefined, resolve=Undefined, spacing=Undefined, + title=Undefined, transform=Undefined, **kwds): + super(VConcatSpec, self).__init__(vconcat=vconcat, bounds=bounds, center=center, data=data, + description=description, name=name, resolve=resolve, + spacing=spacing, title=title, transform=transform, **kwds) -class MarkPropValueDefWithCondition(VegaLiteSchema): - """MarkPropValueDefWithCondition schema wrapper +class ValueDef(VegaLiteSchema): + """ValueDef schema wrapper - Mapping(required=[]) - A ValueDef with Condition + Mapping(required=[value]) + Definition object for a constant value of an encoding channel. Attributes ---------- - condition : anyOf(:class:`ConditionalMarkPropFieldDef`, :class:`ConditionalValueDef`, - List(:class:`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. + A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values + between ``0`` to ``1`` for opacity). """ - _schema = {'$ref': '#/definitions/MarkPropValueDefWithCondition'} + _schema = {'$ref': '#/definitions/ValueDef'} _rootschema = Root._schema - def __init__(self, condition=Undefined, value=Undefined, **kwds): - super(MarkPropValueDefWithCondition, self).__init__(condition=condition, value=value, **kwds) + def __init__(self, value=Undefined, **kwds): + super(ValueDef, self).__init__(value=value, **kwds) -class TextValueDefWithCondition(VegaLiteSchema): - """TextValueDefWithCondition schema wrapper +class ValueDefWithCondition(VegaLiteSchema): + """ValueDefWithCondition schema wrapper Mapping(required=[]) A ValueDef with Condition @@ -8906,17 +8906,17 @@ class TextValueDefWithCondition(VegaLiteSchema): Attributes ---------- - condition : anyOf(:class:`ConditionalTextFieldDef`, :class:`ConditionalValueDef`, + condition : anyOf(:class:`ConditionalFieldDef`, :class:`ConditionalValueDef`, List(:class:`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. """ - _schema = {'$ref': '#/definitions/TextValueDefWithCondition'} + _schema = {'$ref': '#/definitions/ValueDefWithCondition'} _rootschema = Root._schema def __init__(self, condition=Undefined, value=Undefined, **kwds): - super(TextValueDefWithCondition, self).__init__(condition=condition, value=value, **kwds) + super(ValueDefWithCondition, self).__init__(condition=condition, value=value, **kwds) class VerticalAlign(VegaLiteSchema): @@ -9116,7 +9116,7 @@ def __init__(self, *args, **kwds): super(VgBinding, self).__init__(*args, **kwds) -class VgCheckboxBinding(VegaLiteSchema): +class VgCheckboxBinding(VgBinding): """VgCheckboxBinding schema wrapper Mapping(required=[input]) @@ -9136,7 +9136,7 @@ def __init__(self, input=Undefined, element=Undefined, **kwds): super(VgCheckboxBinding, self).__init__(input=input, element=element, **kwds) -class VgComparatorOrder(VegaLiteSchema): +class VgComparatorOrder(SortOrder): """VgComparatorOrder schema wrapper enum('ascending', 'descending') @@ -9160,7 +9160,7 @@ def __init__(self, **kwds): super(VgEventStream, self).__init__(**kwds) -class VgGenericBinding(VegaLiteSchema): +class VgGenericBinding(VgBinding): """VgGenericBinding schema wrapper Mapping(required=[input]) @@ -9390,7 +9390,7 @@ def __init__(self, *args): super(VgProjectionType, self).__init__(*args) -class VgRadioBinding(VegaLiteSchema): +class VgRadioBinding(VgBinding): """VgRadioBinding schema wrapper Mapping(required=[input, options]) @@ -9412,7 +9412,7 @@ def __init__(self, input=Undefined, options=Undefined, element=Undefined, **kwds super(VgRadioBinding, self).__init__(input=input, options=options, element=element, **kwds) -class VgRangeBinding(VegaLiteSchema): +class VgRangeBinding(VgBinding): """VgRangeBinding schema wrapper Mapping(required=[input]) @@ -9440,7 +9440,7 @@ def __init__(self, input=Undefined, element=Undefined, max=Undefined, min=Undefi **kwds) -class VgScheme(VegaLiteSchema): +class VgScheme(RangeConfigValue): """VgScheme schema wrapper Mapping(required=[scheme]) @@ -9462,7 +9462,7 @@ def __init__(self, scheme=Undefined, count=Undefined, extent=Undefined, **kwds): super(VgScheme, self).__init__(scheme=scheme, count=count, extent=extent, **kwds) -class VgSelectBinding(VegaLiteSchema): +class VgSelectBinding(VgBinding): """VgSelectBinding schema wrapper Mapping(required=[input, options]) @@ -9659,7 +9659,7 @@ def __init__(self, *args): super(WindowOnlyOp, self).__init__(*args) -class WindowTransform(VegaLiteSchema): +class WindowTransform(Transform): """WindowTransform schema wrapper Mapping(required=[window]) diff --git a/altair/vegalite/v3/api.py b/altair/vegalite/v3/api.py index ceef45ef9..6dc875a5d 100644 --- a/altair/vegalite/v3/api.py +++ b/altair/vegalite/v3/api.py @@ -1546,16 +1546,9 @@ def from_dict(cls, dct, validate=True): jsonschema.ValidationError : if validate=True and dct does not conform to the schema """ - # First try from_dict for the Chart type - try: - return super(Chart, cls).from_dict(dct, validate=validate) - except jsonschema.ValidationError: - pass - - # If this fails, try with all other top level types for class_ in TopLevelMixin.__subclasses__(): if class_ is Chart: - continue + class_ = super(Chart, cls) try: return class_.from_dict(dct, validate=validate) except jsonschema.ValidationError: diff --git a/altair/vegalite/v3/schema/core.py b/altair/vegalite/v3/schema/core.py index 74595eb8c..dd5e83c61 100644 --- a/altair/vegalite/v3/schema/core.py +++ b/altair/vegalite/v3/schema/core.py @@ -3,7 +3,7 @@ # The contents of this file are automatically written by # tools/generate_schema_wrapper.py. Do not modify directly. -from altair.utils.schemapi import SchemaBase, Undefined +from altair.utils.schemapi import SchemaBase, Undefined, _subclasses import pkgutil import json @@ -16,7 +16,7 @@ def load_schema(): class VegaLiteSchema(SchemaBase): @classmethod def _default_wrapper_classes(cls): - return VegaLiteSchema.__subclasses__() + return _subclasses(VegaLiteSchema) class Root(VegaLiteSchema): @@ -48,7 +48,7 @@ def __init__(self, *args, **kwds): super(Aggregate, self).__init__(*args, **kwds) -class AggregateOp(VegaLiteSchema): +class AggregateOp(Aggregate): """AggregateOp schema wrapper enum('argmax', 'argmin', 'average', 'count', 'distinct', 'max', 'mean', 'median', 'min', @@ -62,27 +62,6 @@ def __init__(self, *args): super(AggregateOp, self).__init__(*args) -class AggregateTransform(VegaLiteSchema): - """AggregateTransform schema wrapper - - Mapping(required=[aggregate]) - - Attributes - ---------- - - aggregate : List(:class:`AggregatedFieldDef`) - Array of objects that define fields to aggregate. - groupby : List(:class:`FieldName`) - The data fields to group by. If not specified, a single group containing all data - objects will be used. - """ - _schema = {'$ref': '#/definitions/AggregateTransform'} - _rootschema = Root._schema - - def __init__(self, aggregate=Undefined, groupby=Undefined, **kwds): - super(AggregateTransform, self).__init__(aggregate=aggregate, groupby=groupby, **kwds) - - class AggregatedFieldDef(VegaLiteSchema): """AggregatedFieldDef schema wrapper @@ -418,7 +397,7 @@ def __init__(self, align=Undefined, angle=Undefined, baseline=Undefined, color=U y2=y2, **kwds) -class ArgmaxDef(VegaLiteSchema): +class ArgmaxDef(Aggregate): """ArgmaxDef schema wrapper Mapping(required=[argmax]) @@ -436,7 +415,7 @@ def __init__(self, argmax=Undefined, **kwds): super(ArgmaxDef, self).__init__(argmax=argmax, **kwds) -class ArgminDef(VegaLiteSchema): +class ArgminDef(Aggregate): """ArgminDef schema wrapper Mapping(required=[argmin]) @@ -1462,18 +1441,6 @@ def __init__(self, align=Undefined, anchor=Undefined, angle=Undefined, baseline= offset=offset, orient=orient, **kwds) -class Baseline(VegaLiteSchema): - """Baseline schema wrapper - - enum('top', 'middle', 'bottom') - """ - _schema = {'$ref': '#/definitions/Baseline'} - _rootschema = Root._schema - - def __init__(self, *args): - super(Baseline, self).__init__(*args) - - class BinParams(VegaLiteSchema): """BinParams schema wrapper @@ -1532,30 +1499,20 @@ def __init__(self, anchor=Undefined, base=Undefined, binned=Undefined, divide=Un step=step, steps=steps, **kwds) -class BinTransform(VegaLiteSchema): - """BinTransform schema wrapper - - Mapping(required=[bin, field, as]) - - Attributes - ---------- +class Binding(VegaLiteSchema): + """Binding schema wrapper - bin : anyOf(enum(True), :class:`BinParams`) - An object indicating bin properties, or simply ``true`` for using default bin - parameters. - field : :class:`FieldName` - The data field to bin. - as : anyOf(:class:`FieldName`, List(:class:`FieldName`)) - The output fields at which to write the start and end bin values. + anyOf(:class:`BindCheckbox`, :class:`BindRadioSelect`, :class:`BindRange`, + :class:`InputBinding`) """ - _schema = {'$ref': '#/definitions/BinTransform'} + _schema = {'$ref': '#/definitions/Binding'} _rootschema = Root._schema - def __init__(self, bin=Undefined, field=Undefined, **kwds): - super(BinTransform, self).__init__(bin=bin, field=field, **kwds) + def __init__(self, *args, **kwds): + super(Binding, self).__init__(*args, **kwds) -class BindCheckbox(VegaLiteSchema): +class BindCheckbox(Binding): """BindCheckbox schema wrapper Mapping(required=[input]) @@ -1583,7 +1540,7 @@ def __init__(self, input=Undefined, debounce=Undefined, element=Undefined, name= type=type, **kwds) -class BindRadioSelect(VegaLiteSchema): +class BindRadioSelect(Binding): """BindRadioSelect schema wrapper Mapping(required=[input, options]) @@ -1613,7 +1570,7 @@ def __init__(self, input=Undefined, options=Undefined, debounce=Undefined, eleme element=element, name=name, type=type, **kwds) -class BindRange(VegaLiteSchema): +class BindRange(Binding): """BindRange schema wrapper Mapping(required=[input]) @@ -1647,31 +1604,6 @@ def __init__(self, input=Undefined, debounce=Undefined, element=Undefined, max=U min=min, name=name, step=step, type=type, **kwds) -class Binding(VegaLiteSchema): - """Binding schema wrapper - - anyOf(:class:`BindCheckbox`, :class:`BindRadioSelect`, :class:`BindRange`, - :class:`InputBinding`) - """ - _schema = {'$ref': '#/definitions/Binding'} - _rootschema = Root._schema - - def __init__(self, *args, **kwds): - super(Binding, self).__init__(*args, **kwds) - - -class BoxPlot(VegaLiteSchema): - """BoxPlot schema wrapper - - enum('boxplot') - """ - _schema = {'$ref': '#/definitions/BoxPlot'} - _rootschema = Root._schema - - def __init__(self, *args): - super(BoxPlot, self).__init__(*args) - - class BoxPlotConfig(VegaLiteSchema): """BoxPlotConfig schema wrapper @@ -1714,74 +1646,6 @@ def __init__(self, box=Undefined, extent=Undefined, median=Undefined, outliers=U rule=rule, size=size, ticks=ticks, **kwds) -class BoxPlotDef(VegaLiteSchema): - """BoxPlotDef schema wrapper - - Mapping(required=[type]) - - Attributes - ---------- - - type : :class:`BoxPlot` - The mark type. This could a primitive mark type - (one of ``"bar"``, ``"circle"``, ``"square"``, ``"tick"``, ``"line"``, - ``"area"``, ``"point"``, ``"geoshape"``, ``"rule"``, and ``"text"`` ) - or a composite mark type ( ``"boxplot"``, ``"errorband"``, ``"errorbar"`` ). - box : anyOf(boolean, :class:`MarkConfig`) - - clip : boolean - Whether a composite mark be clipped to the enclosing group’s width and height. - color : :class:`Color` - Default color. Note that ``fill`` and ``stroke`` have higher precedence than - ``color`` and will override ``color``. - - **Default value:** :raw-html:`` - ``"#4682b4"`` - - **Note:** This property cannot be used in a `style config - `__. - extent : anyOf(enum('min-max'), float) - The extent of the whiskers. Available options include: - - - * ``"min-max"`` : min and max are the lower and upper whiskers respectively. - * A number representing multiple of the interquartile range. This number will be - multiplied by the IQR to determine whisker boundary, which spans from the smallest - data to the largest data within the range *[Q1 - k * IQR, Q3 + k * IQR]* where - *Q1* and *Q3* are the first and third quartiles while *IQR* is the interquartile - range ( *Q3-Q1* ). - - **Default value:** ``1.5``. - median : anyOf(boolean, :class:`MarkConfig`) - - opacity : float - The opacity (value between [0,1]) of the mark. - orient : :class:`Orientation` - Orientation of the box plot. This is normally automatically determined based on - types of fields on x and y channels. However, an explicit ``orient`` be specified - when the orientation is ambiguous. - - **Default value:** ``"vertical"``. - outliers : anyOf(boolean, :class:`MarkConfig`) - - rule : anyOf(boolean, :class:`MarkConfig`) - - size : float - Size of the box and median tick of a box plot - ticks : anyOf(boolean, :class:`MarkConfig`) - - """ - _schema = {'$ref': '#/definitions/BoxPlotDef'} - _rootschema = Root._schema - - def __init__(self, type=Undefined, box=Undefined, clip=Undefined, color=Undefined, extent=Undefined, - median=Undefined, opacity=Undefined, orient=Undefined, outliers=Undefined, - rule=Undefined, size=Undefined, ticks=Undefined, **kwds): - super(BoxPlotDef, self).__init__(type=type, box=box, clip=clip, color=color, extent=extent, - median=median, opacity=opacity, orient=orient, - outliers=outliers, rule=rule, size=size, ticks=ticks, **kwds) - - class BrushConfig(VegaLiteSchema): """BrushConfig schema wrapper @@ -1822,27 +1686,6 @@ def __init__(self, fill=Undefined, fillOpacity=Undefined, stroke=Undefined, stro strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, **kwds) -class CalculateTransform(VegaLiteSchema): - """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 : :class:`FieldName` - The field for storing the computed formula value. - """ - _schema = {'$ref': '#/definitions/CalculateTransform'} - _rootschema = Root._schema - - def __init__(self, calculate=Undefined, **kwds): - super(CalculateTransform, self).__init__(calculate=calculate, **kwds) - - class Color(VegaLiteSchema): """Color schema wrapper @@ -1855,7 +1698,7 @@ def __init__(self, *args, **kwds): super(Color, self).__init__(*args, **kwds) -class ColorName(VegaLiteSchema): +class ColorName(Color): """ColorName schema wrapper enum('black', 'silver', 'gray', 'white', 'maroon', 'red', 'purple', 'fuchsia', 'green', @@ -1889,221 +1732,108 @@ def __init__(self, *args): super(ColorName, self).__init__(*args) -class Encoding(VegaLiteSchema): - """Encoding schema wrapper +class CompositeMark(AnyMark): + """CompositeMark schema wrapper - Mapping(required=[]) + anyOf(:class:`BoxPlot`, :class:`ErrorBar`, :class:`ErrorBand`) + """ + _schema = {'$ref': '#/definitions/CompositeMark'} + _rootschema = Root._schema - Attributes - ---------- + def __init__(self, *args, **kwds): + super(CompositeMark, self).__init__(*args, **kwds) - color : anyOf(:class:`StringFieldDefWithCondition`, :class:`StringValueDefWithCondition`) - 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. +class BoxPlot(CompositeMark): + """BoxPlot schema wrapper - *Note:* - 1) For fine-grained control over both fill and stroke colors of the marks, please - use the ``fill`` and ``stroke`` channels. If either ``fill`` or ``stroke`` channel - is specified, ``color`` channel will be ignored. - 2) See the scale documentation for more information about customizing `color scheme - `__. - detail : anyOf(:class:`FieldDefWithoutScale`, List(:class:`FieldDefWithoutScale`)) - 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(:class:`StringFieldDefWithCondition`, :class:`StringValueDefWithCondition`) - Fill color of the marks. - **Default value:** If undefined, the default color depends on `mark config - `__ 's ``color`` property. + enum('boxplot') + """ + _schema = {'$ref': '#/definitions/BoxPlot'} + _rootschema = Root._schema - *Note:* When using ``fill`` channel, ``color`` channel will be ignored. To customize - both fill and stroke, please use ``fill`` and ``stroke`` channels (not ``fill`` and - ``color`` ). - fillOpacity : anyOf(:class:`NumericFieldDefWithCondition`, - :class:`NumericValueDefWithCondition`) - Fill opacity of the marks. + def __init__(self, *args): + super(BoxPlot, self).__init__(*args) - **Default value:** If undefined, the default opacity depends on `mark config - `__ 's ``fillOpacity`` - property. - href : anyOf(:class:`TextFieldDefWithCondition`, :class:`TextValueDefWithCondition`) - A URL to load upon mouse click. - key : :class:`FieldDefWithoutScale` - 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 : anyOf(:class:`LatLongFieldDef`, :class:`NumberValueDef`) - Latitude position of geographically projected marks. - latitude2 : anyOf(:class:`SecondaryFieldDef`, :class:`NumberValueDef`) - Latitude-2 position for geographically projected ranged ``"area"``, ``"bar"``, - ``"rect"``, and ``"rule"``. - longitude : anyOf(:class:`LatLongFieldDef`, :class:`NumberValueDef`) - Longitude position of geographically projected marks. - longitude2 : anyOf(:class:`SecondaryFieldDef`, :class:`NumberValueDef`) - Longitude-2 position for geographically projected ranged ``"area"``, ``"bar"``, - ``"rect"``, and ``"rule"``. - opacity : anyOf(:class:`NumericFieldDefWithCondition`, - :class:`NumericValueDefWithCondition`) - Opacity of the marks. - **Default value:** If undefined, the default opacity depends on `mark config - `__ 's ``opacity`` property. - order : anyOf(:class:`OrderFieldDef`, List(:class:`OrderFieldDef`), :class:`NumberValueDef`) - Order of the marks. +class CompositeMarkDef(AnyMark): + """CompositeMarkDef schema wrapper + anyOf(:class:`BoxPlotDef`, :class:`ErrorBarDef`, :class:`ErrorBandDef`) + """ + _schema = {'$ref': '#/definitions/CompositeMarkDef'} + _rootschema = Root._schema - * 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 - `__. - Setting ``order`` 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. + def __init__(self, *args, **kwds): + super(CompositeMarkDef, self).__init__(*args, **kwds) - **Note** : In aggregate plots, ``order`` field should be ``aggregate`` d to avoid - creating additional aggregation grouping. - shape : anyOf(:class:`ShapeFieldDefWithCondition`, :class:`ShapeValueDefWithCondition`) - Shape of the mark. - - - #. - For ``point`` marks the supported values include: - - - * plotting shapes: ``"circle"``, ``"square"``, ``"cross"``, ``"diamond"``, - ``"triangle-up"``, ``"triangle-down"``, ``"triangle-right"``, or - ``"triangle-left"``. - * the line symbol ``"stroke"`` - * centered directional shapes ``"arrow"``, ``"wedge"``, or ``"triangle"`` - * a custom `SVG path string - `__ (For correct - sizing, custom shape paths should be defined within a square bounding box with - coordinates ranging from -1 to 1 along both the x and y dimensions.) - - #. - For ``geoshape`` marks it should be a field definition of the geojson data - - **Default value:** If undefined, the default shape depends on `mark config - `__ 's ``shape`` - property. ( ``"circle"`` if unset.) - size : anyOf(:class:`NumericFieldDefWithCondition`, :class:`NumericValueDefWithCondition`) - 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) - stroke : anyOf(:class:`StringFieldDefWithCondition`, :class:`StringValueDefWithCondition`) - 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 use ``stroke`` and ``fill`` channels (not - ``stroke`` and ``color`` ). - strokeOpacity : anyOf(:class:`NumericFieldDefWithCondition`, - :class:`NumericValueDefWithCondition`) - Stroke opacity of the marks. +class BoxPlotDef(CompositeMarkDef): + """BoxPlotDef schema wrapper - **Default value:** If undefined, the default opacity depends on `mark config - `__ 's ``strokeOpacity`` - property. - strokeWidth : anyOf(:class:`NumericFieldDefWithCondition`, - :class:`NumericValueDefWithCondition`) - Stroke width of the marks. + Mapping(required=[type]) - **Default value:** If undefined, the default stroke width depends on `mark config - `__ 's ``strokeWidth`` - property. - text : anyOf(:class:`TextFieldDefWithCondition`, :class:`TextValueDefWithCondition`) - Text of the ``text`` mark. - tooltip : anyOf(:class:`TextFieldDefWithCondition`, :class:`TextValueDefWithCondition`, - List(:class:`TextFieldDef`), None) - The tooltip text to show upon mouse hover. - x : anyOf(:class:`PositionFieldDef`, :class:`XValueDef`) - X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without - specified ``x2`` or ``width``. + Attributes + ---------- - The ``value`` of this channel can be a number or a string ``"width"`` for the width - of the plot. - x2 : anyOf(:class:`SecondaryFieldDef`, :class:`XValueDef`) - X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + type : :class:`BoxPlot` + The mark type. This could a primitive mark type + (one of ``"bar"``, ``"circle"``, ``"square"``, ``"tick"``, ``"line"``, + ``"area"``, ``"point"``, ``"geoshape"``, ``"rule"``, and ``"text"`` ) + or a composite mark type ( ``"boxplot"``, ``"errorband"``, ``"errorbar"`` ). + box : anyOf(boolean, :class:`MarkConfig`) - The ``value`` of this channel can be a number or a string ``"width"`` for the width - of the plot. - xError : anyOf(:class:`SecondaryFieldDef`, :class:`NumberValueDef`) - Error value of x coordinates for error specified ``"errorbar"`` and ``"errorband"``. - xError2 : anyOf(:class:`SecondaryFieldDef`, :class:`NumberValueDef`) - Secondary error value of x coordinates for error specified ``"errorbar"`` and - ``"errorband"``. - y : anyOf(:class:`PositionFieldDef`, :class:`YValueDef`) - Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without - specified ``y2`` or ``height``. + clip : boolean + Whether a composite mark be clipped to the enclosing group’s width and height. + color : :class:`Color` + Default color. Note that ``fill`` and ``stroke`` have higher precedence than + ``color`` and will override ``color``. - The ``value`` of this channel can be a number or a string ``"height"`` for the - height of the plot. - y2 : anyOf(:class:`SecondaryFieldDef`, :class:`YValueDef`) - Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + **Default value:** :raw-html:`` + ``"#4682b4"`` - The ``value`` of this channel can be a number or a string ``"height"`` for the - height of the plot. - yError : anyOf(:class:`SecondaryFieldDef`, :class:`NumberValueDef`) - Error value of y coordinates for error specified ``"errorbar"`` and ``"errorband"``. - yError2 : anyOf(:class:`SecondaryFieldDef`, :class:`NumberValueDef`) - Secondary error value of y coordinates for error specified ``"errorbar"`` and - ``"errorband"``. - """ - _schema = {'$ref': '#/definitions/Encoding'} - _rootschema = Root._schema + **Note:** This property cannot be used in a `style config + `__. + extent : anyOf(enum('min-max'), float) + The extent of the whiskers. Available options include: - def __init__(self, color=Undefined, detail=Undefined, fill=Undefined, fillOpacity=Undefined, - href=Undefined, key=Undefined, latitude=Undefined, latitude2=Undefined, - longitude=Undefined, longitude2=Undefined, opacity=Undefined, order=Undefined, - shape=Undefined, size=Undefined, stroke=Undefined, strokeOpacity=Undefined, - strokeWidth=Undefined, text=Undefined, tooltip=Undefined, x=Undefined, x2=Undefined, - xError=Undefined, xError2=Undefined, y=Undefined, y2=Undefined, yError=Undefined, - yError2=Undefined, **kwds): - super(Encoding, self).__init__(color=color, detail=detail, fill=fill, fillOpacity=fillOpacity, - href=href, key=key, latitude=latitude, latitude2=latitude2, - longitude=longitude, longitude2=longitude2, opacity=opacity, - order=order, shape=shape, size=size, stroke=stroke, - strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, text=text, - tooltip=tooltip, x=x, x2=x2, xError=xError, xError2=xError2, y=y, - y2=y2, yError=yError, yError2=yError2, **kwds) + * ``"min-max"`` : min and max are the lower and upper whiskers respectively. + * A number representing multiple of the interquartile range. This number will be + multiplied by the IQR to determine whisker boundary, which spans from the smallest + data to the largest data within the range *[Q1 - k * IQR, Q3 + k * IQR]* where + *Q1* and *Q3* are the first and third quartiles while *IQR* is the interquartile + range ( *Q3-Q1* ). -class CompositeMark(VegaLiteSchema): - """CompositeMark schema wrapper + **Default value:** ``1.5``. + median : anyOf(boolean, :class:`MarkConfig`) - anyOf(:class:`BoxPlot`, :class:`ErrorBar`, :class:`ErrorBand`) - """ - _schema = {'$ref': '#/definitions/CompositeMark'} - _rootschema = Root._schema + opacity : float + The opacity (value between [0,1]) of the mark. + orient : :class:`Orientation` + Orientation of the box plot. This is normally automatically determined based on + types of fields on x and y channels. However, an explicit ``orient`` be specified + when the orientation is ambiguous. - def __init__(self, *args, **kwds): - super(CompositeMark, self).__init__(*args, **kwds) + **Default value:** ``"vertical"``. + outliers : anyOf(boolean, :class:`MarkConfig`) + rule : anyOf(boolean, :class:`MarkConfig`) -class CompositeMarkDef(VegaLiteSchema): - """CompositeMarkDef schema wrapper + size : float + Size of the box and median tick of a box plot + ticks : anyOf(boolean, :class:`MarkConfig`) - anyOf(:class:`BoxPlotDef`, :class:`ErrorBarDef`, :class:`ErrorBandDef`) """ - _schema = {'$ref': '#/definitions/CompositeMarkDef'} + _schema = {'$ref': '#/definitions/BoxPlotDef'} _rootschema = Root._schema - def __init__(self, *args, **kwds): - super(CompositeMarkDef, self).__init__(*args, **kwds) + def __init__(self, type=Undefined, box=Undefined, clip=Undefined, color=Undefined, extent=Undefined, + median=Undefined, opacity=Undefined, orient=Undefined, outliers=Undefined, + rule=Undefined, size=Undefined, ticks=Undefined, **kwds): + super(BoxPlotDef, self).__init__(type=type, box=box, clip=clip, color=color, extent=extent, + median=median, opacity=opacity, orient=orient, + outliers=outliers, rule=rule, size=size, ticks=ticks, **kwds) class CompositionConfig(VegaLiteSchema): @@ -2171,43 +1901,6 @@ def __init__(self, *args, **kwds): super(ConditionalMarkPropFieldDefTypeForShape, self).__init__(*args, **kwds) -class ConditionalTextFieldDef(VegaLiteSchema): - """ConditionalTextFieldDef schema wrapper - - anyOf(:class:`ConditionalPredicateTextFieldDef`, :class:`ConditionalSelectionTextFieldDef`) - """ - _schema = {'$ref': '#/definitions/ConditionalTextFieldDef'} - _rootschema = Root._schema - - def __init__(self, *args, **kwds): - super(ConditionalTextFieldDef, self).__init__(*args, **kwds) - - -class ConditionalStringValueDef(VegaLiteSchema): - """ConditionalStringValueDef schema wrapper - - anyOf(:class:`ConditionalPredicateStringValueDef`, - :class:`ConditionalSelectionStringValueDef`) - """ - _schema = {'$ref': '#/definitions/ConditionalStringValueDef'} - _rootschema = Root._schema - - def __init__(self, *args, **kwds): - super(ConditionalStringValueDef, self).__init__(*args, **kwds) - - -class ConditionalValueDef(VegaLiteSchema): - """ConditionalValueDef schema wrapper - - anyOf(:class:`ConditionalPredicateValueDef`, :class:`ConditionalSelectionValueDef`) - """ - _schema = {'$ref': '#/definitions/ConditionalValueDef'} - _rootschema = Root._schema - - def __init__(self, *args, **kwds): - super(ConditionalValueDef, self).__init__(*args, **kwds) - - class ConditionalNumberValueDef(VegaLiteSchema): """ConditionalNumberValueDef schema wrapper @@ -2221,7 +1914,7 @@ def __init__(self, *args, **kwds): super(ConditionalNumberValueDef, self).__init__(*args, **kwds) -class ConditionalPredicateMarkPropFieldDef(VegaLiteSchema): +class ConditionalPredicateMarkPropFieldDef(ConditionalMarkPropFieldDef): """ConditionalPredicateMarkPropFieldDef schema wrapper Mapping(required=[test, type]) @@ -2413,7 +2106,7 @@ def __init__(self, test=Undefined, type=Undefined, aggregate=Undefined, bin=Unde **kwds) -class ConditionalPredicateMarkPropFieldDefTypeForShape(VegaLiteSchema): +class ConditionalPredicateMarkPropFieldDefTypeForShape(ConditionalMarkPropFieldDefTypeForShape): """ConditionalPredicateMarkPropFieldDefTypeForShape schema wrapper Mapping(required=[test, type]) @@ -2606,16 +2299,39 @@ def __init__(self, test=Undefined, type=Undefined, aggregate=Undefined, bin=Unde title=title, **kwds) -class ConditionalPredicateTextFieldDef(VegaLiteSchema): - """ConditionalPredicateTextFieldDef schema wrapper +class ConditionalPredicateNumberValueDef(ConditionalNumberValueDef): + """ConditionalPredicateNumberValueDef schema wrapper - Mapping(required=[test, type]) + Mapping(required=[test, value]) Attributes ---------- test : :class:`LogicalOperandPredicate` Predicate for triggering the condition + value : float + A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values + between ``0`` to ``1`` for opacity). + """ + _schema = {'$ref': '#/definitions/ConditionalPredicate'} + _rootschema = Root._schema + + def __init__(self, test=Undefined, value=Undefined, **kwds): + super(ConditionalPredicateNumberValueDef, self).__init__(test=test, value=value, **kwds) + + +class ConditionalSelectionMarkPropFieldDef(ConditionalMarkPropFieldDef): + """ConditionalSelectionMarkPropFieldDef schema wrapper + + Mapping(required=[selection, type]) + + Attributes + ---------- + + selection : :class:`SelectionOperand` + A `selection name `__, or a + series of `composed selections + `__. type : :class:`StandardType` The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, ``"ordinal"``, or ``"nominal"`` ). @@ -2660,7 +2376,7 @@ class ConditionalPredicateTextFieldDef(VegaLiteSchema): **See also:** `aggregate `__ documentation. - bin : anyOf(boolean, :class:`BinParams`, enum('binned'), None) + bin : anyOf(boolean, :class:`BinParams`, None) A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite ( @@ -2698,33 +2414,61 @@ class ConditionalPredicateTextFieldDef(VegaLiteSchema): See more details about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - format : string - The text formatting pattern for labels of guides (axes, legends, headers) and text - marks. + legend : anyOf(:class:`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. - * If the format type is ``"number"`` (e.g., for quantitative fields), this is D3's - `number format pattern `__. - * If the format type is ``"time"`` (e.g., for temporal fields), this is D3's `time - format pattern `__. + **See also:** `legend `__ + documentation. + scale : anyOf(:class:`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. - See the `format documentation `__ - for more examples. + If ``null``, the scale will be `disabled and the data value will be directly encoded + `__. - **Default value:** Derived from `numberFormat - `__ config for number - format and from `timeFormat - `__ config for time - format. - formatType : enum('number', 'time') - The format type for labels ( ``"number"`` or ``"time"`` ). + **Default value:** If undefined, default `scale properties + `__ are applied. - **Default value:** + **See also:** `scale `__ + documentation. + sort : :class:`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: - * ``"time"`` for temporal fields and ordinal and nomimal fields with ``timeUnit``. - * ``"number"`` for quantitative fields as well as ordinal and nomimal fields without - ``timeUnit``. + + * ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in + Javascript. + * `A sort-by-encoding definition + `__ for sorting + by another encoding channel. (This type of sort definition is not available for + ``row`` and ``column`` channels.) + * `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 for ``row`` and ``column``. + + **See also:** `sort `__ + documentation. timeUnit : :class:`TimeUnit` Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal field. @@ -2756,84 +2500,22 @@ class ConditionalPredicateTextFieldDef(VegaLiteSchema): 2) If both field definition's ``title`` and axis, header, or legend ``title`` are defined, axis/header/legend title will be used. """ - _schema = {'$ref': '#/definitions/ConditionalPredicate'} + _schema = {'$ref': '#/definitions/ConditionalSelection'} _rootschema = Root._schema - def __init__(self, test=Undefined, type=Undefined, aggregate=Undefined, bin=Undefined, - field=Undefined, format=Undefined, formatType=Undefined, timeUnit=Undefined, + def __init__(self, selection=Undefined, type=Undefined, aggregate=Undefined, bin=Undefined, + field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, **kwds): - super(ConditionalPredicateTextFieldDef, self).__init__(test=test, type=type, - aggregate=aggregate, bin=bin, - field=field, format=format, - formatType=formatType, timeUnit=timeUnit, - title=title, **kwds) - - -class ConditionalPredicateStringValueDef(VegaLiteSchema): - """ConditionalPredicateStringValueDef schema wrapper - - Mapping(required=[test, value]) - - Attributes - ---------- - - test : :class:`LogicalOperandPredicate` - Predicate for triggering the condition - value : anyOf(string, None) - A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values - between ``0`` to ``1`` for opacity). - """ - _schema = {'$ref': '#/definitions/ConditionalPredicate'} - _rootschema = Root._schema - - def __init__(self, test=Undefined, value=Undefined, **kwds): - super(ConditionalPredicateStringValueDef, self).__init__(test=test, value=value, **kwds) - - -class ConditionalPredicateValueDef(VegaLiteSchema): - """ConditionalPredicateValueDef schema wrapper - - Mapping(required=[test, value]) - - Attributes - ---------- - - test : :class:`LogicalOperandPredicate` - Predicate for triggering the condition - value : :class:`Value` - A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values - between ``0`` to ``1`` for opacity). - """ - _schema = {'$ref': '#/definitions/ConditionalPredicate'} - _rootschema = Root._schema - - def __init__(self, test=Undefined, value=Undefined, **kwds): - super(ConditionalPredicateValueDef, self).__init__(test=test, value=value, **kwds) - - -class ConditionalPredicateNumberValueDef(VegaLiteSchema): - """ConditionalPredicateNumberValueDef schema wrapper - - Mapping(required=[test, value]) - - Attributes - ---------- - - test : :class:`LogicalOperandPredicate` - Predicate for triggering the condition - value : float - A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values - between ``0`` to ``1`` for opacity). - """ - _schema = {'$ref': '#/definitions/ConditionalPredicate'} - _rootschema = Root._schema - - def __init__(self, test=Undefined, value=Undefined, **kwds): - super(ConditionalPredicateNumberValueDef, self).__init__(test=test, value=value, **kwds) + super(ConditionalSelectionMarkPropFieldDef, self).__init__(selection=selection, type=type, + aggregate=aggregate, bin=bin, + field=field, legend=legend, + scale=scale, sort=sort, + timeUnit=timeUnit, title=title, + **kwds) -class ConditionalSelectionMarkPropFieldDef(VegaLiteSchema): - """ConditionalSelectionMarkPropFieldDef schema wrapper +class ConditionalSelectionMarkPropFieldDefTypeForShape(ConditionalMarkPropFieldDefTypeForShape): + """ConditionalSelectionMarkPropFieldDefTypeForShape schema wrapper Mapping(required=[selection, type]) @@ -2844,7 +2526,7 @@ class ConditionalSelectionMarkPropFieldDef(VegaLiteSchema): A `selection name `__, or a series of `composed selections `__. - type : :class:`StandardType` + type : :class:`TypeForShape` The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, ``"ordinal"``, or ``"nominal"`` ). It can also be a ``"geojson"`` type for encoding `'geoshape' @@ -3012,24 +2694,26 @@ class ConditionalSelectionMarkPropFieldDef(VegaLiteSchema): 2) If both field definition's ``title`` and axis, header, or legend ``title`` are defined, axis/header/legend title will be used. """ - _schema = {'$ref': '#/definitions/ConditionalSelection'} + _schema = {'$ref': '#/definitions/ConditionalSelection>'} _rootschema = Root._schema def __init__(self, selection=Undefined, type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, **kwds): - super(ConditionalSelectionMarkPropFieldDef, self).__init__(selection=selection, type=type, - aggregate=aggregate, bin=bin, - field=field, legend=legend, - scale=scale, sort=sort, - timeUnit=timeUnit, title=title, - **kwds) + super(ConditionalSelectionMarkPropFieldDefTypeForShape, self).__init__(selection=selection, + type=type, + aggregate=aggregate, + bin=bin, field=field, + legend=legend, + scale=scale, sort=sort, + timeUnit=timeUnit, + title=title, **kwds) -class ConditionalSelectionMarkPropFieldDefTypeForShape(VegaLiteSchema): - """ConditionalSelectionMarkPropFieldDefTypeForShape schema wrapper +class ConditionalSelectionNumberValueDef(ConditionalNumberValueDef): + """ConditionalSelectionNumberValueDef schema wrapper - Mapping(required=[selection, type]) + Mapping(required=[selection, value]) Attributes ---------- @@ -3038,7 +2722,99 @@ class ConditionalSelectionMarkPropFieldDefTypeForShape(VegaLiteSchema): A `selection name `__, or a series of `composed selections `__. - type : :class:`TypeForShape` + value : float + A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values + between ``0`` to ``1`` for opacity). + """ + _schema = {'$ref': '#/definitions/ConditionalSelection'} + _rootschema = Root._schema + + def __init__(self, selection=Undefined, value=Undefined, **kwds): + super(ConditionalSelectionNumberValueDef, self).__init__(selection=selection, value=value, + **kwds) + + +class ConditionalStringValueDef(VegaLiteSchema): + """ConditionalStringValueDef schema wrapper + + anyOf(:class:`ConditionalPredicateStringValueDef`, + :class:`ConditionalSelectionStringValueDef`) + """ + _schema = {'$ref': '#/definitions/ConditionalStringValueDef'} + _rootschema = Root._schema + + def __init__(self, *args, **kwds): + super(ConditionalStringValueDef, self).__init__(*args, **kwds) + + +class ConditionalPredicateStringValueDef(ConditionalStringValueDef): + """ConditionalPredicateStringValueDef schema wrapper + + Mapping(required=[test, value]) + + Attributes + ---------- + + test : :class:`LogicalOperandPredicate` + Predicate for triggering the condition + value : anyOf(string, None) + A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values + between ``0`` to ``1`` for opacity). + """ + _schema = {'$ref': '#/definitions/ConditionalPredicate'} + _rootschema = Root._schema + + def __init__(self, test=Undefined, value=Undefined, **kwds): + super(ConditionalPredicateStringValueDef, self).__init__(test=test, value=value, **kwds) + + +class ConditionalSelectionStringValueDef(ConditionalStringValueDef): + """ConditionalSelectionStringValueDef schema wrapper + + Mapping(required=[selection, value]) + + Attributes + ---------- + + selection : :class:`SelectionOperand` + A `selection name `__, or a + series of `composed selections + `__. + value : anyOf(string, None) + A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values + between ``0`` to ``1`` for opacity). + """ + _schema = {'$ref': '#/definitions/ConditionalSelection'} + _rootschema = Root._schema + + def __init__(self, selection=Undefined, value=Undefined, **kwds): + super(ConditionalSelectionStringValueDef, self).__init__(selection=selection, value=value, + **kwds) + + +class ConditionalTextFieldDef(VegaLiteSchema): + """ConditionalTextFieldDef schema wrapper + + anyOf(:class:`ConditionalPredicateTextFieldDef`, :class:`ConditionalSelectionTextFieldDef`) + """ + _schema = {'$ref': '#/definitions/ConditionalTextFieldDef'} + _rootschema = Root._schema + + def __init__(self, *args, **kwds): + super(ConditionalTextFieldDef, self).__init__(*args, **kwds) + + +class ConditionalPredicateTextFieldDef(ConditionalTextFieldDef): + """ConditionalPredicateTextFieldDef schema wrapper + + Mapping(required=[test, type]) + + Attributes + ---------- + + test : :class:`LogicalOperandPredicate` + Predicate for triggering the condition + type : :class:`StandardType` The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, ``"ordinal"``, or ``"nominal"`` ). It can also be a ``"geojson"`` type for encoding `'geoshape' @@ -3082,7 +2858,7 @@ class ConditionalSelectionMarkPropFieldDefTypeForShape(VegaLiteSchema): **See also:** `aggregate `__ documentation. - bin : anyOf(boolean, :class:`BinParams`, None) + bin : anyOf(boolean, :class:`BinParams`, enum('binned'), None) A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite ( @@ -3120,61 +2896,33 @@ class ConditionalSelectionMarkPropFieldDefTypeForShape(VegaLiteSchema): See more details about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - legend : anyOf(:class:`Legend`, None) - An object defining properties of the legend. - If ``null``, the legend for the encoding channel will be removed. + format : string + The text formatting pattern for labels of guides (axes, legends, headers) and text + marks. - **Default value:** If undefined, default `legend properties - `__ are applied. - **See also:** `legend `__ - documentation. - scale : anyOf(:class:`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 the format type is ``"number"`` (e.g., for quantitative fields), this is D3's + `number format pattern `__. + * If the format type is ``"time"`` (e.g., for temporal fields), this is D3's `time + format pattern `__. - If ``null``, the scale will be `disabled and the data value will be directly encoded - `__. + See the `format documentation `__ + for more examples. - **Default value:** If undefined, default `scale properties - `__ are applied. - - **See also:** `scale `__ - documentation. - sort : :class:`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-by-encoding definition - `__ for sorting - by another encoding channel. (This type of sort definition is not available for - ``row`` and ``column`` channels.) - * `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:** Derived from `numberFormat + `__ config for number + format and from `timeFormat + `__ config for time + format. + formatType : enum('number', 'time') + The format type for labels ( ``"number"`` or ``"time"`` ). - **Default value:** ``"ascending"`` + **Default value:** - **Note:** ``null`` is not supported for ``row`` and ``column``. - **See also:** `sort `__ - documentation. + * ``"time"`` for temporal fields and ordinal and nomimal fields with ``timeUnit``. + * ``"number"`` for quantitative fields as well as ordinal and nomimal fields without + ``timeUnit``. timeUnit : :class:`TimeUnit` Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal field. @@ -3206,23 +2954,20 @@ class ConditionalSelectionMarkPropFieldDefTypeForShape(VegaLiteSchema): 2) If both field definition's ``title`` and axis, header, or legend ``title`` are defined, axis/header/legend title will be used. """ - _schema = {'$ref': '#/definitions/ConditionalSelection>'} + _schema = {'$ref': '#/definitions/ConditionalPredicate'} _rootschema = Root._schema - def __init__(self, selection=Undefined, type=Undefined, aggregate=Undefined, bin=Undefined, - field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, + def __init__(self, test=Undefined, type=Undefined, aggregate=Undefined, bin=Undefined, + field=Undefined, format=Undefined, formatType=Undefined, timeUnit=Undefined, title=Undefined, **kwds): - super(ConditionalSelectionMarkPropFieldDefTypeForShape, self).__init__(selection=selection, - type=type, - aggregate=aggregate, - bin=bin, field=field, - legend=legend, - scale=scale, sort=sort, - timeUnit=timeUnit, - title=title, **kwds) + super(ConditionalPredicateTextFieldDef, self).__init__(test=test, type=type, + aggregate=aggregate, bin=bin, + field=field, format=format, + formatType=formatType, timeUnit=timeUnit, + title=title, **kwds) -class ConditionalSelectionTextFieldDef(VegaLiteSchema): +class ConditionalSelectionTextFieldDef(ConditionalTextFieldDef): """ConditionalSelectionTextFieldDef schema wrapper Mapping(required=[selection, type]) @@ -3387,55 +3132,41 @@ def __init__(self, selection=Undefined, type=Undefined, aggregate=Undefined, bin title=title, **kwds) -class ConditionalSelectionStringValueDef(VegaLiteSchema): - """ConditionalSelectionStringValueDef schema wrapper - - Mapping(required=[selection, value]) - - Attributes - ---------- +class ConditionalValueDef(VegaLiteSchema): + """ConditionalValueDef schema wrapper - selection : :class:`SelectionOperand` - A `selection name `__, or a - series of `composed selections - `__. - value : anyOf(string, None) - A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values - between ``0`` to ``1`` for opacity). + anyOf(:class:`ConditionalPredicateValueDef`, :class:`ConditionalSelectionValueDef`) """ - _schema = {'$ref': '#/definitions/ConditionalSelection'} + _schema = {'$ref': '#/definitions/ConditionalValueDef'} _rootschema = Root._schema - def __init__(self, selection=Undefined, value=Undefined, **kwds): - super(ConditionalSelectionStringValueDef, self).__init__(selection=selection, value=value, - **kwds) + def __init__(self, *args, **kwds): + super(ConditionalValueDef, self).__init__(*args, **kwds) -class ConditionalSelectionValueDef(VegaLiteSchema): - """ConditionalSelectionValueDef schema wrapper +class ConditionalPredicateValueDef(ConditionalValueDef): + """ConditionalPredicateValueDef schema wrapper - Mapping(required=[selection, value]) + Mapping(required=[test, value]) Attributes ---------- - selection : :class:`SelectionOperand` - A `selection name `__, or a - series of `composed selections - `__. + test : :class:`LogicalOperandPredicate` + Predicate for triggering the condition value : :class:`Value` A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values between ``0`` to ``1`` for opacity). """ - _schema = {'$ref': '#/definitions/ConditionalSelection'} + _schema = {'$ref': '#/definitions/ConditionalPredicate'} _rootschema = Root._schema - def __init__(self, selection=Undefined, value=Undefined, **kwds): - super(ConditionalSelectionValueDef, self).__init__(selection=selection, value=value, **kwds) + def __init__(self, test=Undefined, value=Undefined, **kwds): + super(ConditionalPredicateValueDef, self).__init__(test=test, value=value, **kwds) -class ConditionalSelectionNumberValueDef(VegaLiteSchema): - """ConditionalSelectionNumberValueDef schema wrapper +class ConditionalSelectionValueDef(ConditionalValueDef): + """ConditionalSelectionValueDef schema wrapper Mapping(required=[selection, value]) @@ -3446,16 +3177,15 @@ class ConditionalSelectionNumberValueDef(VegaLiteSchema): A `selection name `__, or a series of `composed selections `__. - value : float + value : :class:`Value` A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values between ``0`` to ``1`` for opacity). """ - _schema = {'$ref': '#/definitions/ConditionalSelection'} + _schema = {'$ref': '#/definitions/ConditionalSelection'} _rootschema = Root._schema def __init__(self, selection=Undefined, value=Undefined, **kwds): - super(ConditionalSelectionNumberValueDef, self).__init__(selection=selection, value=value, - **kwds) + super(ConditionalSelectionValueDef, self).__init__(selection=selection, value=value, **kwds) class Config(VegaLiteSchema): @@ -3674,45 +3404,6 @@ def __init__(self, area=Undefined, autosize=Undefined, axis=Undefined, axisBand= timeFormat=timeFormat, title=title, trail=trail, view=view, **kwds) -class CsvDataFormat(VegaLiteSchema): - """CsvDataFormat schema wrapper - - Mapping(required=[]) - - Attributes - ---------- - - parse : anyOf(:class:`Parse`, None) - If set to ``null``, 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 the ``modified_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"``. - - **Default value:** The default format type is determined by the extension of the - file URL. - If no extension is detected, ``"json"`` will be used by default. - """ - _schema = {'$ref': '#/definitions/CsvDataFormat'} - _rootschema = Root._schema - - def __init__(self, parse=Undefined, type=Undefined, **kwds): - super(CsvDataFormat, self).__init__(parse=parse, type=type, **kwds) - - class Cursor(VegaLiteSchema): """Cursor schema wrapper @@ -3754,7 +3445,46 @@ def __init__(self, *args, **kwds): super(DataFormat, self).__init__(*args, **kwds) -class DataSource(VegaLiteSchema): +class CsvDataFormat(DataFormat): + """CsvDataFormat schema wrapper + + Mapping(required=[]) + + Attributes + ---------- + + parse : anyOf(:class:`Parse`, None) + If set to ``null``, 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 the ``modified_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"``. + + **Default value:** The default format type is determined by the extension of the + file URL. + If no extension is detected, ``"json"`` will be used by default. + """ + _schema = {'$ref': '#/definitions/CsvDataFormat'} + _rootschema = Root._schema + + def __init__(self, parse=Undefined, type=Undefined, **kwds): + super(CsvDataFormat, self).__init__(parse=parse, type=type, **kwds) + + +class DataSource(Data): """DataSource schema wrapper anyOf(:class:`UrlData`, :class:`InlineData`, :class:`NamedData`) @@ -3778,57 +3508,6 @@ def __init__(self, **kwds): super(Datasets, self).__init__(**kwds) -class DateTime(VegaLiteSchema): - """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(:class:`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"`` ). :raw-html:`
` - **Warning:** A DateTime definition object with ``day`` ** should not be combined - with ``year``, ``quarter``, ``month``, or ``date``. - 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(:class:`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. - """ - _schema = {'$ref': '#/definitions/DateTime'} - _rootschema = Root._schema - - def __init__(self, date=Undefined, day=Undefined, hours=Undefined, milliseconds=Undefined, - minutes=Undefined, month=Undefined, quarter=Undefined, seconds=Undefined, - utc=Undefined, year=Undefined, **kwds): - super(DateTime, self).__init__(date=date, day=day, hours=hours, milliseconds=milliseconds, - minutes=minutes, month=month, quarter=quarter, seconds=seconds, - utc=utc, year=year, **kwds) - - class Day(VegaLiteSchema): """Day schema wrapper @@ -3865,7 +3544,7 @@ def __init__(self, *args): super(Dir, self).__init__(*args) -class DsvDataFormat(VegaLiteSchema): +class DsvDataFormat(DataFormat): """DsvDataFormat schema wrapper Mapping(required=[delimiter]) @@ -3920,44 +3599,200 @@ def __init__(self, *args): super(Element, self).__init__(*args) -class EncodingSortField(VegaLiteSchema): - """EncodingSortField schema wrapper +class Encoding(VegaLiteSchema): + """Encoding schema wrapper Mapping(required=[]) - A sort definition for sorting a discrete scale in an encoding field definition. Attributes ---------- - field : :class:`Field` - The data `field `__ to sort by. + color : anyOf(:class:`StringFieldDefWithCondition`, :class:`StringValueDefWithCondition`) + 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 unspecified, defaults to the field specified in the outer data - reference. - op : :class:`AggregateOp` - An `aggregate operation - `__ to perform on the - field prior to sorting (e.g., ``"count"``, ``"mean"`` and ``"median"`` ). - An aggregation is required when there are multiple values of the sort field for each - encoded data field. - The input data objects will be aggregated, grouped by the encoded data field. + **Default value:** If undefined, the default color depends on `mark config + `__ 's ``color`` property. - For a full list of operations, please see the documentation for `aggregate - `__. + *Note:* + 1) For fine-grained control over both fill and stroke colors of the marks, please + use the ``fill`` and ``stroke`` channels. If either ``fill`` or ``stroke`` channel + is specified, ``color`` channel will be ignored. + 2) See the scale documentation for more information about customizing `color scheme + `__. + detail : anyOf(:class:`FieldDefWithoutScale`, List(:class:`FieldDefWithoutScale`)) + 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(:class:`StringFieldDefWithCondition`, :class:`StringValueDefWithCondition`) + Fill color of the marks. + **Default value:** If undefined, the default color depends on `mark config + `__ 's ``color`` property. - **Default value:** ``"sum"`` for stacked plots. Otherwise, ``"mean"``. - order : anyOf(:class:`SortOrder`, None) - The sort order. One of ``"ascending"`` (default), ``"descending"``, or ``null`` (no - not sort). + *Note:* When using ``fill`` channel, ``color`` channel will be ignored. To customize + both fill and stroke, please use ``fill`` and ``stroke`` channels (not ``fill`` and + ``color`` ). + fillOpacity : anyOf(:class:`NumericFieldDefWithCondition`, + :class:`NumericValueDefWithCondition`) + Fill opacity of the marks. + + **Default value:** If undefined, the default opacity depends on `mark config + `__ 's ``fillOpacity`` + property. + href : anyOf(:class:`TextFieldDefWithCondition`, :class:`TextValueDefWithCondition`) + A URL to load upon mouse click. + key : :class:`FieldDefWithoutScale` + 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 : anyOf(:class:`LatLongFieldDef`, :class:`NumberValueDef`) + Latitude position of geographically projected marks. + latitude2 : anyOf(:class:`SecondaryFieldDef`, :class:`NumberValueDef`) + Latitude-2 position for geographically projected ranged ``"area"``, ``"bar"``, + ``"rect"``, and ``"rule"``. + longitude : anyOf(:class:`LatLongFieldDef`, :class:`NumberValueDef`) + Longitude position of geographically projected marks. + longitude2 : anyOf(:class:`SecondaryFieldDef`, :class:`NumberValueDef`) + Longitude-2 position for geographically projected ranged ``"area"``, ``"bar"``, + ``"rect"``, and ``"rule"``. + opacity : anyOf(:class:`NumericFieldDefWithCondition`, + :class:`NumericValueDefWithCondition`) + Opacity of the marks. + + **Default value:** If undefined, the default opacity depends on `mark config + `__ 's ``opacity`` property. + order : anyOf(:class:`OrderFieldDef`, List(:class:`OrderFieldDef`), :class:`NumberValueDef`) + 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 + `__. + Setting ``order`` 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 be ``aggregate`` d to avoid + creating additional aggregation grouping. + shape : anyOf(:class:`ShapeFieldDefWithCondition`, :class:`ShapeValueDefWithCondition`) + Shape of the mark. + + + #. + For ``point`` marks the supported values include: + + + * plotting shapes: ``"circle"``, ``"square"``, ``"cross"``, ``"diamond"``, + ``"triangle-up"``, ``"triangle-down"``, ``"triangle-right"``, or + ``"triangle-left"``. + * the line symbol ``"stroke"`` + * centered directional shapes ``"arrow"``, ``"wedge"``, or ``"triangle"`` + * a custom `SVG path string + `__ (For correct + sizing, custom shape paths should be defined within a square bounding box with + coordinates ranging from -1 to 1 along both the x and y dimensions.) + + #. + For ``geoshape`` marks it should be a field definition of the geojson data + + **Default value:** If undefined, the default shape depends on `mark config + `__ 's ``shape`` + property. ( ``"circle"`` if unset.) + size : anyOf(:class:`NumericFieldDefWithCondition`, :class:`NumericValueDefWithCondition`) + 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) + stroke : anyOf(:class:`StringFieldDefWithCondition`, :class:`StringValueDefWithCondition`) + 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 use ``stroke`` and ``fill`` channels (not + ``stroke`` and ``color`` ). + strokeOpacity : anyOf(:class:`NumericFieldDefWithCondition`, + :class:`NumericValueDefWithCondition`) + Stroke opacity of the marks. + + **Default value:** If undefined, the default opacity depends on `mark config + `__ 's ``strokeOpacity`` + property. + strokeWidth : anyOf(:class:`NumericFieldDefWithCondition`, + :class:`NumericValueDefWithCondition`) + Stroke width of the marks. + + **Default value:** If undefined, the default stroke width depends on `mark config + `__ 's ``strokeWidth`` + property. + text : anyOf(:class:`TextFieldDefWithCondition`, :class:`TextValueDefWithCondition`) + Text of the ``text`` mark. + tooltip : anyOf(:class:`TextFieldDefWithCondition`, :class:`TextValueDefWithCondition`, + List(:class:`TextFieldDef`), None) + The tooltip text to show upon mouse hover. + x : anyOf(:class:`PositionFieldDef`, :class:`XValueDef`) + X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without + specified ``x2`` or ``width``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + x2 : anyOf(:class:`SecondaryFieldDef`, :class:`XValueDef`) + X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + xError : anyOf(:class:`SecondaryFieldDef`, :class:`NumberValueDef`) + Error value of x coordinates for error specified ``"errorbar"`` and ``"errorband"``. + xError2 : anyOf(:class:`SecondaryFieldDef`, :class:`NumberValueDef`) + Secondary error value of x coordinates for error specified ``"errorbar"`` and + ``"errorband"``. + y : anyOf(:class:`PositionFieldDef`, :class:`YValueDef`) + Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without + specified ``y2`` or ``height``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + y2 : anyOf(:class:`SecondaryFieldDef`, :class:`YValueDef`) + Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + yError : anyOf(:class:`SecondaryFieldDef`, :class:`NumberValueDef`) + Error value of y coordinates for error specified ``"errorbar"`` and ``"errorband"``. + yError2 : anyOf(:class:`SecondaryFieldDef`, :class:`NumberValueDef`) + Secondary error value of y coordinates for error specified ``"errorbar"`` and + ``"errorband"``. """ - _schema = {'$ref': '#/definitions/EncodingSortField'} + _schema = {'$ref': '#/definitions/Encoding'} _rootschema = Root._schema - def __init__(self, field=Undefined, op=Undefined, order=Undefined, **kwds): - super(EncodingSortField, self).__init__(field=field, op=op, order=order, **kwds) + def __init__(self, color=Undefined, detail=Undefined, fill=Undefined, fillOpacity=Undefined, + href=Undefined, key=Undefined, latitude=Undefined, latitude2=Undefined, + longitude=Undefined, longitude2=Undefined, opacity=Undefined, order=Undefined, + shape=Undefined, size=Undefined, stroke=Undefined, strokeOpacity=Undefined, + strokeWidth=Undefined, text=Undefined, tooltip=Undefined, x=Undefined, x2=Undefined, + xError=Undefined, xError2=Undefined, y=Undefined, y2=Undefined, yError=Undefined, + yError2=Undefined, **kwds): + super(Encoding, self).__init__(color=color, detail=detail, fill=fill, fillOpacity=fillOpacity, + href=href, key=key, latitude=latitude, latitude2=latitude2, + longitude=longitude, longitude2=longitude2, opacity=opacity, + order=order, shape=shape, size=size, stroke=stroke, + strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, text=text, + tooltip=tooltip, x=x, x2=x2, xError=xError, xError2=xError2, y=y, + y2=y2, yError=yError, yError2=yError2, **kwds) -class ErrorBand(VegaLiteSchema): +class ErrorBand(CompositeMark): """ErrorBand schema wrapper enum('errorband') @@ -4028,7 +3863,7 @@ def __init__(self, band=Undefined, borders=Undefined, extent=Undefined, interpol interpolate=interpolate, tension=tension, **kwds) -class ErrorBandDef(VegaLiteSchema): +class ErrorBandDef(CompositeMarkDef): """ErrorBandDef schema wrapper Mapping(required=[type]) @@ -4110,7 +3945,7 @@ def __init__(self, type=Undefined, band=Undefined, borders=Undefined, clip=Undef opacity=opacity, orient=orient, tension=tension, **kwds) -class ErrorBar(VegaLiteSchema): +class ErrorBar(CompositeMark): """ErrorBar schema wrapper enum('errorbar') @@ -4154,7 +3989,7 @@ def __init__(self, extent=Undefined, rule=Undefined, ticks=Undefined, **kwds): super(ErrorBarConfig, self).__init__(extent=extent, rule=rule, ticks=ticks, **kwds) -class ErrorBarDef(VegaLiteSchema): +class ErrorBarDef(CompositeMarkDef): """ErrorBarDef schema wrapper Mapping(required=[type]) @@ -4615,213 +4450,34 @@ def __init__(self, color=Undefined, column=Undefined, detail=Undefined, facet=Un yError=yError, yError2=yError2, **kwds) -class FacetedUnitSpec(VegaLiteSchema): - """FacetedUnitSpec schema wrapper - - Mapping(required=[mark]) - Unit spec that can have a composite mark and row or column channels (shorthand for a facet - spec). - - Attributes - ---------- - - mark : :class:`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 `__. - align : anyOf(:class:`LayoutAlign`, :class:`RowColLayoutAlign`) - 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}`` can - be used to supply different alignments for rows and columns. +class Field(VegaLiteSchema): + """Field schema wrapper - **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) or ``flush``. + anyOf(:class:`FieldName`, :class:`RepeatRef`) + """ + _schema = {'$ref': '#/definitions/Field'} + _rootschema = Root._schema + def __init__(self, *args, **kwds): + super(Field, self).__init__(*args, **kwds) - * If set to ``full``, the entire calculated bounds (including axes, title, and - legend) will be used. - * If set to ``flush``, 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, :class:`RowColboolean`) - Boolean flag indicating if subviews should be centered relative to their respective - rows or columns. +class FieldDefWithConditionMarkPropFieldDefTypeForShapestringnull(VegaLiteSchema): + """FieldDefWithConditionMarkPropFieldDefTypeForShapestringnull schema wrapper - An object value of the form ``{"row": boolean, "column": boolean}`` can be used to - supply different centering values for rows and columns. + Mapping(required=[type]) + A FieldDef with Condition :raw-html:`` - **Default value:** ``false`` - columns : float - The number of columns to include in the view composition layout. + Attributes + ---------- - **Default value** : ``undefined`` -- An infinite number of columns (a single row) - will be assumed. This is equivalent to - ``hconcat`` (for ``concat`` ) and to using the ``column`` channel (for ``facet`` and - ``repeat`` ). + type : :class:`TypeForShape` + The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, + ``"ordinal"``, or ``"nominal"`` ). + It can also be a ``"geojson"`` type for encoding `'geoshape' + `__. - **Note** : - - 1) This property is only for: - - - * the general (wrappable) ``concat`` operator (not ``hconcat`` / ``vconcat`` ) - * the ``facet`` and ``repeat`` operator with one field/repetition definition - (without row/column nesting) - - 2) Setting the ``columns`` to ``1`` is equivalent to ``vconcat`` (for ``concat`` ) - and to using the ``row`` channel (for ``facet`` and ``repeat`` ). - data : anyOf(:class:`Data`, None) - An object describing the data source. Set to ``null`` to ignore the parent's data - source. If no data is set, it is derived from the parent. - description : string - Description of this mark for commenting purpose. - encoding : :class:`FacetedEncoding` - 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`` is ``null``, the height will be the value of `config.view.height - `__. - * If no field is mapped to ``y`` channel, the ``height`` will be the value of - ``rangeStep``. - - **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. - name : string - Name of the visualization for later reference. - projection : :class:`Projection` - An object defining properties of geographic projection, which will be applied to - ``shape`` path for ``"geoshape"`` marks - and to ``latitude`` and ``"longitude"`` channels for other marks. - resolve : :class:`Resolve` - Scale, axis, and legend resolutions for view composition specifications. - selection : Mapping(required=[]) - A key-value mapping between selection names and definitions. - spacing : anyOf(float, :class:`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** : Depends on ``"spacing"`` property of `the view composition - configuration `__ ( - ``20`` by default) - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`Transform`) - An array of data transformations such as filter and new field calculation. - view : :class:`ViewBackground` - An object defining the view background's fill and stroke. - - **Default value:** none (transparent) - 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`` is ``null``, the width will be the value of `config.view.width - `__. - * If no field is mapped to ``x`` channel, the ``width`` will be the value of - `config.scale.textXRangeStep - `__ for - ``text`` mark and the value of ``rangeStep`` 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. - """ - _schema = {'$ref': '#/definitions/FacetedUnitSpec'} - _rootschema = Root._schema - - def __init__(self, mark=Undefined, align=Undefined, bounds=Undefined, center=Undefined, - columns=Undefined, data=Undefined, description=Undefined, encoding=Undefined, - height=Undefined, name=Undefined, projection=Undefined, resolve=Undefined, - selection=Undefined, spacing=Undefined, title=Undefined, transform=Undefined, - view=Undefined, width=Undefined, **kwds): - super(FacetedUnitSpec, self).__init__(mark=mark, align=align, bounds=bounds, center=center, - columns=columns, data=data, description=description, - encoding=encoding, height=height, name=name, - projection=projection, resolve=resolve, - selection=selection, spacing=spacing, title=title, - transform=transform, view=view, width=width, **kwds) - - -class Field(VegaLiteSchema): - """Field schema wrapper - - anyOf(:class:`FieldName`, :class:`RepeatRef`) - """ - _schema = {'$ref': '#/definitions/Field'} - _rootschema = Root._schema - - def __init__(self, *args, **kwds): - super(Field, self).__init__(*args, **kwds) - - -class FieldDefWithConditionMarkPropFieldDefstringnull(VegaLiteSchema): - """FieldDefWithConditionMarkPropFieldDefstringnull schema wrapper - - Mapping(required=[type]) - A FieldDef with Condition :raw-html:`` - - Attributes - ---------- - - type : :class:`StandardType` - The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, - ``"ordinal"``, or ``"nominal"`` ). - It can also be a ``"geojson"`` type for encoding `'geoshape' - `__. - - **Note:** + **Note:** * Data values for a temporal field can be either a date-time string (e.g., @@ -4991,21 +4647,23 @@ class FieldDefWithConditionMarkPropFieldDefstringnull(VegaLiteSchema): 2) If both field definition's ``title`` and axis, header, or legend ``title`` are defined, axis/header/legend title will be used. """ - _schema = {'$ref': '#/definitions/FieldDefWithCondition'} + _schema = {'$ref': '#/definitions/FieldDefWithCondition,(string|null)>'} _rootschema = Root._schema def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, **kwds): - super(FieldDefWithConditionMarkPropFieldDefstringnull, self).__init__(type=type, - aggregate=aggregate, - bin=bin, - condition=condition, - field=field, - legend=legend, - scale=scale, sort=sort, - timeUnit=timeUnit, - title=title, **kwds) + super(FieldDefWithConditionMarkPropFieldDefTypeForShapestringnull, self).__init__(type=type, + aggregate=aggregate, + bin=bin, + condition=condition, + field=field, + legend=legend, + scale=scale, + sort=sort, + timeUnit=timeUnit, + title=title, + **kwds) class FieldDefWithConditionMarkPropFieldDefnumber(VegaLiteSchema): @@ -5208,8 +4866,8 @@ def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, condition title=title, **kwds) -class FieldDefWithConditionMarkPropFieldDefTypeForShapestringnull(VegaLiteSchema): - """FieldDefWithConditionMarkPropFieldDefTypeForShapestringnull schema wrapper +class FieldDefWithConditionMarkPropFieldDefstringnull(VegaLiteSchema): + """FieldDefWithConditionMarkPropFieldDefstringnull schema wrapper Mapping(required=[type]) A FieldDef with Condition :raw-html:`` @@ -5217,7 +4875,7 @@ class FieldDefWithConditionMarkPropFieldDefTypeForShapestringnull(VegaLiteSchema Attributes ---------- - type : :class:`TypeForShape` + type : :class:`StandardType` The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, ``"ordinal"``, or ``"nominal"`` ). It can also be a ``"geojson"`` type for encoding `'geoshape' @@ -5393,23 +5051,21 @@ class FieldDefWithConditionMarkPropFieldDefTypeForShapestringnull(VegaLiteSchema 2) If both field definition's ``title`` and axis, header, or legend ``title`` are defined, axis/header/legend title will be used. """ - _schema = {'$ref': '#/definitions/FieldDefWithCondition,(string|null)>'} + _schema = {'$ref': '#/definitions/FieldDefWithCondition'} _rootschema = Root._schema def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, **kwds): - super(FieldDefWithConditionMarkPropFieldDefTypeForShapestringnull, self).__init__(type=type, - aggregate=aggregate, - bin=bin, - condition=condition, - field=field, - legend=legend, - scale=scale, - sort=sort, - timeUnit=timeUnit, - title=title, - **kwds) + super(FieldDefWithConditionMarkPropFieldDefstringnull, self).__init__(type=type, + aggregate=aggregate, + bin=bin, + condition=condition, + field=field, + legend=legend, + scale=scale, sort=sort, + timeUnit=timeUnit, + title=title, **kwds) class FieldDefWithConditionTextFieldDefValue(VegaLiteSchema): @@ -5713,1004 +5369,946 @@ def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, field=Und timeUnit=timeUnit, title=title, **kwds) -class FieldEqualPredicate(VegaLiteSchema): - """FieldEqualPredicate schema wrapper - - Mapping(required=[equal, field]) - - Attributes - ---------- +class FieldName(Field): + """FieldName schema wrapper - equal : anyOf(string, float, boolean, :class:`DateTime`) - The value that the field should be equal to. - field : :class:`FieldName` - Field to be filtered. - timeUnit : :class:`TimeUnit` - Time unit for the field to be filtered. + string """ - _schema = {'$ref': '#/definitions/FieldEqualPredicate'} + _schema = {'$ref': '#/definitions/FieldName'} _rootschema = Root._schema - def __init__(self, equal=Undefined, field=Undefined, timeUnit=Undefined, **kwds): - super(FieldEqualPredicate, self).__init__(equal=equal, field=field, timeUnit=timeUnit, **kwds) + def __init__(self, *args): + super(FieldName, self).__init__(*args) -class FieldGTEPredicate(VegaLiteSchema): - """FieldGTEPredicate schema wrapper +class FontStyle(VegaLiteSchema): + """FontStyle schema wrapper - Mapping(required=[field, gte]) + string + """ + _schema = {'$ref': '#/definitions/FontStyle'} + _rootschema = Root._schema - Attributes - ---------- + def __init__(self, *args): + super(FontStyle, self).__init__(*args) - field : :class:`FieldName` - Field to be filtered. - gte : anyOf(string, float, :class:`DateTime`) - The value that the field should be greater than or equals to. - timeUnit : :class:`TimeUnit` - Time unit for the field to be filtered. + +class FontWeight(VegaLiteSchema): + """FontWeight schema wrapper + + enum('normal', 'bold', 'lighter', 'bolder', 100, 200, 300, 400, 500, 600, 700, 800, 900) """ - _schema = {'$ref': '#/definitions/FieldGTEPredicate'} + _schema = {'$ref': '#/definitions/FontWeight'} _rootschema = Root._schema - def __init__(self, field=Undefined, gte=Undefined, timeUnit=Undefined, **kwds): - super(FieldGTEPredicate, self).__init__(field=field, gte=gte, timeUnit=timeUnit, **kwds) + def __init__(self, *args): + super(FontWeight, self).__init__(*args) -class FieldGTPredicate(VegaLiteSchema): - """FieldGTPredicate schema wrapper +class Generator(Data): + """Generator schema wrapper - Mapping(required=[field, gt]) + anyOf(:class:`SequenceGenerator`, :class:`SphereGenerator`, :class:`GraticuleGenerator`) + """ + _schema = {'$ref': '#/definitions/Generator'} + _rootschema = Root._schema - Attributes - ---------- + def __init__(self, *args, **kwds): + super(Generator, self).__init__(*args, **kwds) - field : :class:`FieldName` - Field to be filtered. - gt : anyOf(string, float, :class:`DateTime`) - The value that the field should be greater than. - timeUnit : :class:`TimeUnit` - Time unit for the field to be filtered. - """ - _schema = {'$ref': '#/definitions/FieldGTPredicate'} - _rootschema = Root._schema - def __init__(self, field=Undefined, gt=Undefined, timeUnit=Undefined, **kwds): - super(FieldGTPredicate, self).__init__(field=field, gt=gt, timeUnit=timeUnit, **kwds) - - -class FieldLTEPredicate(VegaLiteSchema): - """FieldLTEPredicate schema wrapper +class GenericUnitSpecEncodingAnyMark(VegaLiteSchema): + """GenericUnitSpecEncodingAnyMark schema wrapper - Mapping(required=[field, lte]) + Mapping(required=[mark]) + Base interface for a unit (single-view) specification. Attributes ---------- - field : :class:`FieldName` - Field to be filtered. - lte : anyOf(string, float, :class:`DateTime`) - The value that the field should be less than or equals to. - timeUnit : :class:`TimeUnit` - Time unit for the field to be filtered. - """ - _schema = {'$ref': '#/definitions/FieldLTEPredicate'} - _rootschema = Root._schema + mark : :class:`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 : anyOf(:class:`Data`, None) + An object describing the data source. Set to ``null`` to ignore the parent's data + source. If no data is set, it is derived from the parent. + description : string + Description of this mark for commenting purpose. + encoding : :class:`Encoding` + A key-value mapping between encoding channels and definition of fields. + height : float + The height of a visualization. - def __init__(self, field=Undefined, lte=Undefined, timeUnit=Undefined, **kwds): - super(FieldLTEPredicate, self).__init__(field=field, lte=lte, timeUnit=timeUnit, **kwds) + **Default value:** -class FieldLTPredicate(VegaLiteSchema): - """FieldLTPredicate schema wrapper + * 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`` is ``null``, the height will be the value of `config.view.height + `__. + * If no field is mapped to ``y`` channel, the ``height`` will be the value of + ``rangeStep``. - Mapping(required=[field, lt]) + **Note** : For plots with `row and column channels + `__, this represents the + height of a single view. - Attributes - ---------- + **See also:** The documentation for `width and height + `__ contains more examples. + name : string + Name of the visualization for later reference. + projection : :class:`Projection` + An object defining properties of geographic projection, which will be applied to + ``shape`` path for ``"geoshape"`` marks + and to ``latitude`` and ``"longitude"`` channels for other marks. + selection : Mapping(required=[]) + A key-value mapping between selection names and definitions. + title : anyOf(string, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`Transform`) + An array of data transformations such as filter and new field calculation. + view : :class:`ViewBackground` + An object defining the view background's fill and stroke. - field : :class:`FieldName` - Field to be filtered. - lt : anyOf(string, float, :class:`DateTime`) - The value that the field should be less than. - timeUnit : :class:`TimeUnit` - Time unit for the field to be filtered. - """ - _schema = {'$ref': '#/definitions/FieldLTPredicate'} - _rootschema = Root._schema + **Default value:** none (transparent) + width : float + The width of a visualization. - def __init__(self, field=Undefined, lt=Undefined, timeUnit=Undefined, **kwds): - super(FieldLTPredicate, self).__init__(field=field, lt=lt, timeUnit=timeUnit, **kwds) + **Default value:** This will be determined by the following rules: -class FieldName(VegaLiteSchema): - """FieldName schema wrapper + * 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`` is ``null``, the width will be the value of `config.view.width + `__. + * If no field is mapped to ``x`` channel, the ``width`` will be the value of + `config.scale.textXRangeStep + `__ for + ``text`` mark and the value of ``rangeStep`` for other marks. - string + **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. """ - _schema = {'$ref': '#/definitions/FieldName'} + _schema = {'$ref': '#/definitions/GenericUnitSpec'} _rootschema = Root._schema - def __init__(self, *args): - super(FieldName, self).__init__(*args) + def __init__(self, mark=Undefined, data=Undefined, description=Undefined, encoding=Undefined, + height=Undefined, name=Undefined, projection=Undefined, selection=Undefined, + title=Undefined, transform=Undefined, view=Undefined, width=Undefined, **kwds): + super(GenericUnitSpecEncodingAnyMark, self).__init__(mark=mark, data=data, + description=description, encoding=encoding, + height=height, name=name, + projection=projection, selection=selection, + title=title, transform=transform, + view=view, width=width, **kwds) -class FieldOneOfPredicate(VegaLiteSchema): - """FieldOneOfPredicate schema wrapper +class GraticuleGenerator(Generator): + """GraticuleGenerator schema wrapper - Mapping(required=[field, oneOf]) + Mapping(required=[graticule]) Attributes ---------- - field : :class:`FieldName` - Field to be filtered. - oneOf : anyOf(List(string), List(float), List(boolean), List(:class:`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 : :class:`TimeUnit` - Time unit for the field to be filtered. + graticule : anyOf(enum(True), :class:`GraticuleParams`) + Generate graticule GeoJSON data for geographic reference lines. + name : string + Provide a placeholder name and bind data at runtime. """ - _schema = {'$ref': '#/definitions/FieldOneOfPredicate'} + _schema = {'$ref': '#/definitions/GraticuleGenerator'} _rootschema = Root._schema - def __init__(self, field=Undefined, oneOf=Undefined, timeUnit=Undefined, **kwds): - super(FieldOneOfPredicate, self).__init__(field=field, oneOf=oneOf, timeUnit=timeUnit, **kwds) + def __init__(self, graticule=Undefined, name=Undefined, **kwds): + super(GraticuleGenerator, self).__init__(graticule=graticule, name=name, **kwds) -class FieldRangePredicate(VegaLiteSchema): - """FieldRangePredicate schema wrapper +class GraticuleParams(VegaLiteSchema): + """GraticuleParams schema wrapper - Mapping(required=[field, range]) + Mapping(required=[]) Attributes ---------- - field : :class:`FieldName` - Field to be filtered. - range : List(anyOf(float, :class:`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 : :class:`TimeUnit` - Time unit for the field to be filtered. - """ - _schema = {'$ref': '#/definitions/FieldRangePredicate'} - _rootschema = Root._schema - - def __init__(self, field=Undefined, range=Undefined, timeUnit=Undefined, **kwds): - super(FieldRangePredicate, self).__init__(field=field, range=range, timeUnit=timeUnit, **kwds) - - -class FieldValidPredicate(VegaLiteSchema): - """FieldValidPredicate schema wrapper + extent : List(List(float)) + Sets both the major and minor extents to the same values. + extentMajor : List(List(float)) + The major extent of the graticule as a two-element array of coordinates. + extentMinor : List(List(float)) + The minor extent of the graticule as a two-element array of coordinates. + precision : float + The precision of the graticule in degrees. - Mapping(required=[field, valid]) + **Default value:** ``2.5`` + step : List(float) + Sets both the major and minor step angles to the same values. + stepMajor : List(float) + The major step angles of the graticule. - Attributes - ---------- + **Default value:** ``[90, 360]`` + stepMinor : List(float) + The minor step angles of the graticule. - field : :class:`FieldName` - Field to be filtered. - valid : boolean - If set to true the field's value has to be valid, meaning both not ``null`` and not - `NaN - `__. - timeUnit : :class:`TimeUnit` - Time unit for the field to be filtered. + **Default value:** ``[10, 10]`` """ - _schema = {'$ref': '#/definitions/FieldValidPredicate'} + _schema = {'$ref': '#/definitions/GraticuleParams'} _rootschema = Root._schema - def __init__(self, field=Undefined, valid=Undefined, timeUnit=Undefined, **kwds): - super(FieldValidPredicate, self).__init__(field=field, valid=valid, timeUnit=timeUnit, **kwds) + def __init__(self, extent=Undefined, extentMajor=Undefined, extentMinor=Undefined, + precision=Undefined, step=Undefined, stepMajor=Undefined, stepMinor=Undefined, **kwds): + super(GraticuleParams, self).__init__(extent=extent, extentMajor=extentMajor, + extentMinor=extentMinor, precision=precision, step=step, + stepMajor=stepMajor, stepMinor=stepMinor, **kwds) -class FilterTransform(VegaLiteSchema): - """FilterTransform schema wrapper +class Header(VegaLiteSchema): + """Header schema wrapper - Mapping(required=[filter]) + Mapping(required=[]) + Headers of row / column channels for faceted plots. Attributes ---------- - filter : :class:`LogicalOperandPredicate` - The ``filter`` property must be one of the predicate definitions: + format : string + The text formatting pattern for labels of guides (axes, legends, headers) and text + marks. - 1) an `expression `__ - string, - where ``datum`` can be used to refer to the current data object - 2) one of the field predicates: `equal - `__, - `lt `__, - `lte `__, - `gt `__, - `gte `__, - `range `__, - `oneOf `__, - or `valid `__, + * If the format type is ``"number"`` (e.g., for quantitative fields), this is D3's + `number format pattern `__. + * If the format type is ``"time"`` (e.g., for temporal fields), this is D3's `time + format pattern `__. - 3) a `selection predicate - `__ + See the `format documentation `__ + for more examples. - 4) a logical operand that combines (1), (2), or (3). - """ - _schema = {'$ref': '#/definitions/FilterTransform'} - _rootschema = Root._schema + **Default value:** Derived from `numberFormat + `__ config for number + format and from `timeFormat + `__ config for time + format. + formatType : enum('number', 'time') + The format type for labels ( ``"number"`` or ``"time"`` ). - def __init__(self, filter=Undefined, **kwds): - super(FilterTransform, self).__init__(filter=filter, **kwds) - - -class FlattenTransform(VegaLiteSchema): - """FlattenTransform schema wrapper + **Default value:** - Mapping(required=[flatten]) - Attributes - ---------- + * ``"time"`` for temporal fields and ordinal and nomimal fields with ``timeUnit``. + * ``"number"`` for quantitative fields as well as ordinal and nomimal fields without + ``timeUnit``. + labelAlign : :class:`Align` + Horizontal text alignment of header labels. + labelAnchor : :class:`TitleAnchor` + The anchor position for placing the labels. One of ``"start"``, ``"middle"``, or + ``"end"``. For example, with a label orientation of top these anchor positions map + to a left-, center-, or right-aligned label. + labelAngle : float + The rotation angle of the header labels. - flatten : List(:class:`FieldName`) - An array of one or more data fields containing arrays to flatten. - If multiple fields are specified, their array values should have a parallel - structure, ideally with the same length. - If the lengths of parallel arrays do not match, - the longest array will be used with ``null`` values added for missing entries. - as : List(:class:`FieldName`) - The output field names for extracted array values. + **Default value:** ``0`` for column header, ``-90`` for row header. + labelColor : :class:`Color` + 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. + labelFontStyle : :class:`FontStyle` + The font style of the header label. + 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:** The field name of the corresponding array field - """ - _schema = {'$ref': '#/definitions/FlattenTransform'} - _rootschema = Root._schema + **Default value:** ``0``, indicating no limit + labelOrient : :class:`Orient` + The orientation of the header label. One of ``"top"``, ``"bottom"``, ``"left"`` or + ``"right"``. + labelPadding : float + The padding, in pixel, between facet header's label and the plot. - def __init__(self, flatten=Undefined, **kwds): - super(FlattenTransform, self).__init__(flatten=flatten, **kwds) + **Default value:** ``10`` + labels : boolean + A boolean flag indicating if labels should be included as part of the header. + **Default value:** ``true``. + title : anyOf(string, None) + A title for the field. If ``null``, the title will be removed. -class FoldTransform(VegaLiteSchema): - """FoldTransform schema wrapper + **Default value:** derived from the field's name and transformation function ( + ``aggregate``, ``bin`` and ``timeUnit`` ). 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. - Mapping(required=[fold]) + **Notes** : - Attributes - ---------- + 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 + `__. - fold : List(:class:`FieldName`) - An array of data fields indicating the properties to fold. - as : List([:class:`FieldName`, :class:`FieldName`]) - The output field names for the key and value properties produced by the fold - transform. - **Default value:** ``["key", "value"]`` - """ - _schema = {'$ref': '#/definitions/FoldTransform'} - _rootschema = Root._schema + 2) If both field definition's ``title`` and axis, header, or legend ``title`` are + defined, axis/header/legend title will be used. + titleAlign : :class:`Align` + Horizontal text alignment (to the anchor) of header titles. + titleAnchor : :class:`TitleAnchor` + 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. + titleAngle : float + The rotation angle of the header title. - def __init__(self, fold=Undefined, **kwds): - super(FoldTransform, self).__init__(fold=fold, **kwds) + **Default value:** ``0``. + titleBaseline : :class:`TextBaseline` + Vertical text baseline for the header title. One of ``"top"``, ``"bottom"``, + ``"middle"``. + **Default value:** ``"middle"`` + titleColor : :class:`Color` + 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. + titleFontStyle : :class:`FontStyle` + The font style of the header title. + titleFontWeight : :class:`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. -class FontStyle(VegaLiteSchema): - """FontStyle schema wrapper + **Default value:** ``0``, indicating no limit + titleOrient : :class:`Orient` + The orientation of the header title. One of ``"top"``, ``"bottom"``, ``"left"`` or + ``"right"``. + titlePadding : float + The padding, in pixel, between facet header's title and the label. - string + **Default value:** ``10`` """ - _schema = {'$ref': '#/definitions/FontStyle'} + _schema = {'$ref': '#/definitions/Header'} _rootschema = Root._schema - def __init__(self, *args): - super(FontStyle, self).__init__(*args) + def __init__(self, format=Undefined, formatType=Undefined, labelAlign=Undefined, + labelAnchor=Undefined, labelAngle=Undefined, labelColor=Undefined, labelFont=Undefined, + labelFontSize=Undefined, labelFontStyle=Undefined, labelLimit=Undefined, + labelOrient=Undefined, labelPadding=Undefined, labels=Undefined, title=Undefined, + titleAlign=Undefined, titleAnchor=Undefined, titleAngle=Undefined, + titleBaseline=Undefined, titleColor=Undefined, titleFont=Undefined, + titleFontSize=Undefined, titleFontStyle=Undefined, titleFontWeight=Undefined, + titleLimit=Undefined, titleOrient=Undefined, titlePadding=Undefined, **kwds): + super(Header, self).__init__(format=format, formatType=formatType, labelAlign=labelAlign, + labelAnchor=labelAnchor, labelAngle=labelAngle, + labelColor=labelColor, labelFont=labelFont, + labelFontSize=labelFontSize, labelFontStyle=labelFontStyle, + labelLimit=labelLimit, labelOrient=labelOrient, + labelPadding=labelPadding, labels=labels, title=title, + titleAlign=titleAlign, titleAnchor=titleAnchor, + titleAngle=titleAngle, titleBaseline=titleBaseline, + titleColor=titleColor, titleFont=titleFont, + titleFontSize=titleFontSize, titleFontStyle=titleFontStyle, + titleFontWeight=titleFontWeight, titleLimit=titleLimit, + titleOrient=titleOrient, titlePadding=titlePadding, **kwds) -class FontWeight(VegaLiteSchema): - """FontWeight schema wrapper +class HeaderConfig(VegaLiteSchema): + """HeaderConfig schema wrapper - enum('normal', 'bold', 'lighter', 'bolder', 100, 200, 300, 400, 500, 600, 700, 800, 900) - """ - _schema = {'$ref': '#/definitions/FontWeight'} - _rootschema = Root._schema + Mapping(required=[]) - def __init__(self, *args): - super(FontWeight, self).__init__(*args) + Attributes + ---------- + format : string + The text formatting pattern for labels of guides (axes, legends, headers) and text + marks. -class Generator(VegaLiteSchema): - """Generator schema wrapper - anyOf(:class:`SequenceGenerator`, :class:`SphereGenerator`, :class:`GraticuleGenerator`) - """ - _schema = {'$ref': '#/definitions/Generator'} - _rootschema = Root._schema + * If the format type is ``"number"`` (e.g., for quantitative fields), this is D3's + `number format pattern `__. + * If the format type is ``"time"`` (e.g., for temporal fields), this is D3's `time + format pattern `__. - def __init__(self, *args, **kwds): - super(Generator, self).__init__(*args, **kwds) + See the `format documentation `__ + for more examples. + **Default value:** Derived from `numberFormat + `__ config for number + format and from `timeFormat + `__ config for time + format. + formatType : enum('number', 'time') + The format type for labels ( ``"number"`` or ``"time"`` ). -class ConcatSpec(VegaLiteSchema): - """ConcatSpec schema wrapper + **Default value:** - Mapping(required=[concat]) - Base interface for a generalized concatenation specification. - Attributes - ---------- + * ``"time"`` for temporal fields and ordinal and nomimal fields with ``timeUnit``. + * ``"number"`` for quantitative fields as well as ordinal and nomimal fields without + ``timeUnit``. + labelAlign : :class:`Align` + Horizontal text alignment of header labels. + labelAnchor : :class:`TitleAnchor` + The anchor position for placing the labels. One of ``"start"``, ``"middle"``, or + ``"end"``. For example, with a label orientation of top these anchor positions map + to a left-, center-, or right-aligned label. + labelAngle : float + The rotation angle of the header labels. - concat : List(:class:`Spec`) - A list of views to be concatenated. - align : anyOf(:class:`LayoutAlign`, :class:`RowColLayoutAlign`) - The alignment to apply to grid rows and columns. - The supported string values are ``"all"``, ``"each"``, and ``"none"``. + **Default value:** ``0`` for column header, ``-90`` for row header. + labelColor : :class:`Color` + 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. + labelFontStyle : :class:`FontStyle` + The font style of the header label. + 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 + labelOrient : :class:`Orient` + The orientation of the header label. One of ``"top"``, ``"bottom"``, ``"left"`` or + ``"right"``. + labelPadding : float + The padding, in pixel, between facet header's label and the plot. - * 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. + **Default value:** ``10`` + labels : boolean + A boolean flag indicating if labels should be included as part of the header. - Alternatively, an object value of the form ``{"row": string, "column": string}`` can - be used to supply different alignments for rows and columns. + **Default value:** ``true``. + shortTimeLabels : boolean + Whether month names and weekday names should be abbreviated. - **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) or ``flush``. + **Default value:** ``false`` + title : None + Set to null to disable title for the axis, legend, or header. + titleAlign : :class:`Align` + Horizontal text alignment (to the anchor) of header titles. + titleAnchor : :class:`TitleAnchor` + 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. + titleAngle : float + The rotation angle of the header title. + **Default value:** ``0``. + titleBaseline : :class:`TextBaseline` + Vertical text baseline for the header title. One of ``"top"``, ``"bottom"``, + ``"middle"``. - * If set to ``full``, the entire calculated bounds (including axes, title, and - legend) will be used. - * If set to ``flush``, 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:** ``"middle"`` + titleColor : :class:`Color` + 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. + titleFontStyle : :class:`FontStyle` + The font style of the header title. + titleFontWeight : :class:`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:** ``"full"`` - center : anyOf(boolean, :class:`RowColboolean`) - Boolean flag indicating if subviews should be centered relative to their respective - rows or columns. + **Default value:** ``0``, indicating no limit + titleOrient : :class:`Orient` + The orientation of the header title. One of ``"top"``, ``"bottom"``, ``"left"`` or + ``"right"``. + titlePadding : float + The padding, in pixel, between facet header's title and the label. - An object value of the form ``{"row": boolean, "column": boolean}`` can be used to - supply different centering values for rows and columns. + **Default value:** ``10`` + """ + _schema = {'$ref': '#/definitions/HeaderConfig'} + _rootschema = Root._schema - **Default value:** ``false`` - columns : float - The number of columns to include in the view composition layout. + def __init__(self, format=Undefined, formatType=Undefined, labelAlign=Undefined, + labelAnchor=Undefined, labelAngle=Undefined, labelColor=Undefined, labelFont=Undefined, + labelFontSize=Undefined, labelFontStyle=Undefined, labelLimit=Undefined, + labelOrient=Undefined, labelPadding=Undefined, labels=Undefined, + shortTimeLabels=Undefined, title=Undefined, titleAlign=Undefined, + titleAnchor=Undefined, titleAngle=Undefined, titleBaseline=Undefined, + titleColor=Undefined, titleFont=Undefined, titleFontSize=Undefined, + titleFontStyle=Undefined, titleFontWeight=Undefined, titleLimit=Undefined, + titleOrient=Undefined, titlePadding=Undefined, **kwds): + super(HeaderConfig, self).__init__(format=format, formatType=formatType, labelAlign=labelAlign, + labelAnchor=labelAnchor, labelAngle=labelAngle, + labelColor=labelColor, labelFont=labelFont, + labelFontSize=labelFontSize, labelFontStyle=labelFontStyle, + labelLimit=labelLimit, labelOrient=labelOrient, + labelPadding=labelPadding, labels=labels, + shortTimeLabels=shortTimeLabels, title=title, + titleAlign=titleAlign, titleAnchor=titleAnchor, + titleAngle=titleAngle, titleBaseline=titleBaseline, + titleColor=titleColor, titleFont=titleFont, + titleFontSize=titleFontSize, titleFontStyle=titleFontStyle, + titleFontWeight=titleFontWeight, titleLimit=titleLimit, + titleOrient=titleOrient, titlePadding=titlePadding, **kwds) - **Default value** : ``undefined`` -- An infinite number of columns (a single row) - will be assumed. This is equivalent to - ``hconcat`` (for ``concat`` ) and to using the ``column`` channel (for ``facet`` and - ``repeat`` ). - **Note** : +class HexColor(Color): + """HexColor schema wrapper - 1) This property is only for: + string + """ + _schema = {'$ref': '#/definitions/HexColor'} + _rootschema = Root._schema + def __init__(self, *args): + super(HexColor, self).__init__(*args) - * the general (wrappable) ``concat`` operator (not ``hconcat`` / ``vconcat`` ) - * the ``facet`` and ``repeat`` operator with one field/repetition definition - (without row/column nesting) - 2) Setting the ``columns`` to ``1`` is equivalent to ``vconcat`` (for ``concat`` ) - and to using the ``row`` channel (for ``facet`` and ``repeat`` ). - data : anyOf(:class:`Data`, None) - An object describing the data source. Set to ``null`` to ignore the parent's data - source. If no data is set, it is derived from the parent. - description : string - Description of this mark for commenting purpose. - name : string - Name of the visualization for later reference. - resolve : :class:`Resolve` - Scale, axis, and legend resolutions for view composition specifications. - spacing : anyOf(float, :class:`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. +class ImputeMethod(VegaLiteSchema): + """ImputeMethod schema wrapper - **Default value** : Depends on ``"spacing"`` property of `the view composition - configuration `__ ( - ``20`` by default) - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`Transform`) - An array of data transformations such as filter and new field calculation. + enum('value', 'median', 'max', 'min', 'mean') """ - _schema = {'$ref': '#/definitions/ConcatSpec'} + _schema = {'$ref': '#/definitions/ImputeMethod'} _rootschema = Root._schema - def __init__(self, concat=Undefined, align=Undefined, bounds=Undefined, center=Undefined, - columns=Undefined, data=Undefined, description=Undefined, name=Undefined, - resolve=Undefined, spacing=Undefined, title=Undefined, transform=Undefined, **kwds): - super(ConcatSpec, self).__init__(concat=concat, align=align, bounds=bounds, center=center, - columns=columns, data=data, description=description, name=name, - resolve=resolve, spacing=spacing, title=title, - transform=transform, **kwds) + def __init__(self, *args): + super(ImputeMethod, self).__init__(*args) -class FacetSpec(VegaLiteSchema): - """FacetSpec schema wrapper +class ImputeParams(VegaLiteSchema): + """ImputeParams schema wrapper - Mapping(required=[facet, spec]) - Base interface for a facet specification. + Mapping(required=[]) Attributes ---------- - facet : anyOf(:class:`FacetFieldDef`, :class:`FacetMapping`) - Definition for how to facet the data. One of: - 1) `a field definition for faceting the plot by one field - `__ - 2) `An object that maps row and column channels to their field definitions - `__ - spec : anyOf(:class:`LayerSpec`, :class:`FacetedUnitSpec`) - A specification of the view that gets faceted. - align : anyOf(:class:`LayoutAlign`, :class:`RowColLayoutAlign`) - The alignment to apply to grid rows and columns. - The supported string values are ``"all"``, ``"each"``, and ``"none"``. + frame : List(anyOf(None, float)) + A frame specification as a two-element array used to control the window over which + the specified method is applied. 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. For example, the value ``[-5, + 5]`` indicates that the window should include five objects preceding and five + objects following the current object. + **Default value:** : ``[null, null]`` indicating that the window includes all + objects. + keyvals : anyOf(List(Mapping(required=[])), :class:`ImputeSequence`) + Defines the key values that should be considered for imputation. + An array of key values or an object defining a `number sequence + `__. - * 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. + If provided, this will be used in addition to the key values observed within the + input data. If not provided, the values will be derived from all unique values of + the ``key`` field. For ``impute`` in ``encoding``, the key field is the x-field if + the y-field is imputed, or vice versa. - Alternatively, an object value of the form ``{"row": string, "column": string}`` can - be used to supply different alignments for rows and columns. + If there is no impute grouping, this property *must* be specified. + method : :class:`ImputeMethod` + The imputation method to use for the field value of imputed data objects. + One of ``value``, ``mean``, ``median``, ``max`` or ``min``. - **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) or ``flush``. + **Default value:** ``"value"`` + value : Mapping(required=[]) + The field value to use when the imputation ``method`` is ``"value"``. + """ + _schema = {'$ref': '#/definitions/ImputeParams'} + _rootschema = Root._schema + def __init__(self, frame=Undefined, keyvals=Undefined, method=Undefined, value=Undefined, **kwds): + super(ImputeParams, self).__init__(frame=frame, keyvals=keyvals, method=method, value=value, + **kwds) - * If set to ``full``, the entire calculated bounds (including axes, title, and - legend) will be used. - * If set to ``flush``, 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, :class:`RowColboolean`) - Boolean flag indicating if subviews should be centered relative to their respective - rows or columns. +class ImputeSequence(VegaLiteSchema): + """ImputeSequence schema wrapper - An object value of the form ``{"row": boolean, "column": boolean}`` can be used to - supply different centering values for rows and columns. + Mapping(required=[stop]) - **Default value:** ``false`` - columns : float - The number of columns to include in the view composition layout. + Attributes + ---------- - **Default value** : ``undefined`` -- An infinite number of columns (a single row) - will be assumed. This is equivalent to - ``hconcat`` (for ``concat`` ) and to using the ``column`` channel (for ``facet`` and - ``repeat`` ). + stop : float + The ending value(exclusive) of the sequence. + start : float + The starting value of the sequence. + **Default value:** ``0`` + step : float + The step value between sequence entries. + **Default value:** ``1`` or ``-1`` if ``stop < start`` + """ + _schema = {'$ref': '#/definitions/ImputeSequence'} + _rootschema = Root._schema - **Note** : + def __init__(self, stop=Undefined, start=Undefined, step=Undefined, **kwds): + super(ImputeSequence, self).__init__(stop=stop, start=start, step=step, **kwds) - 1) This property is only for: +class InlineData(DataSource): + """InlineData schema wrapper - * the general (wrappable) ``concat`` operator (not ``hconcat`` / ``vconcat`` ) - * the ``facet`` and ``repeat`` operator with one field/repetition definition - (without row/column nesting) + Mapping(required=[values]) - 2) Setting the ``columns`` to ``1`` is equivalent to ``vconcat`` (for ``concat`` ) - and to using the ``row`` channel (for ``facet`` and ``repeat`` ). - data : anyOf(:class:`Data`, None) - An object describing the data source. Set to ``null`` to ignore the parent's data - source. If no data is set, it is derived from the parent. - description : string - Description of this mark for commenting purpose. - name : string - Name of the visualization for later reference. - resolve : :class:`Resolve` - Scale, axis, and legend resolutions for view composition specifications. - spacing : anyOf(float, :class:`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. + Attributes + ---------- - **Default value** : Depends on ``"spacing"`` property of `the view composition - configuration `__ ( - ``20`` by default) - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`Transform`) - An array of data transformations such as filter and new field calculation. + values : :class:`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 : :class:`DataFormat` + An object that specifies the format for parsing the data. + name : string + Provide a placeholder name and bind data at runtime. """ - _schema = {'$ref': '#/definitions/FacetSpec'} + _schema = {'$ref': '#/definitions/InlineData'} _rootschema = Root._schema - def __init__(self, facet=Undefined, spec=Undefined, align=Undefined, bounds=Undefined, - center=Undefined, columns=Undefined, data=Undefined, description=Undefined, - name=Undefined, resolve=Undefined, spacing=Undefined, title=Undefined, - transform=Undefined, **kwds): - super(FacetSpec, self).__init__(facet=facet, spec=spec, align=align, bounds=bounds, - center=center, columns=columns, data=data, - description=description, name=name, resolve=resolve, - spacing=spacing, title=title, transform=transform, **kwds) + def __init__(self, values=Undefined, format=Undefined, name=Undefined, **kwds): + super(InlineData, self).__init__(values=values, format=format, name=name, **kwds) -class HConcatSpec(VegaLiteSchema): - """HConcatSpec schema wrapper +class InlineDataset(VegaLiteSchema): + """InlineDataset schema wrapper - Mapping(required=[hconcat]) - Base interface for a horizontal concatenation specification. + anyOf(List(float), List(string), List(boolean), List(Mapping(required=[])), string, + Mapping(required=[])) + """ + _schema = {'$ref': '#/definitions/InlineDataset'} + _rootschema = Root._schema + + def __init__(self, *args, **kwds): + super(InlineDataset, self).__init__(*args, **kwds) + + +class InputBinding(Binding): + """InputBinding schema wrapper + + Mapping(required=[]) Attributes ---------- - hconcat : List(:class:`Spec`) - A list of views to 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) or ``flush``. + autocomplete : string + debounce : float - * If set to ``full``, the entire calculated bounds (including axes, title, and - legend) will be used. - * If set to ``flush``, 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. + element : :class:`Element` - **Default value:** ``"full"`` - center : boolean - Boolean flag indicating if subviews should be centered relative to their respective - rows or columns. + input : string - **Default value:** ``false`` - data : anyOf(:class:`Data`, None) - An object describing the data source. Set to ``null`` to ignore the parent's data - source. If no data is set, it is derived from the parent. - description : string - Description of this mark for commenting purpose. name : string - Name of the visualization for later reference. - resolve : :class:`Resolve` - Scale, axis, and legend resolutions for view composition specifications. - spacing : float - The spacing in pixels between sub-views of the concat operator. - **Default value** : ``10`` - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`Transform`) - An array of data transformations such as filter and new field calculation. + placeholder : string + + type : string + """ - _schema = {'$ref': '#/definitions/HConcatSpec'} + _schema = {'$ref': '#/definitions/InputBinding'} _rootschema = Root._schema - def __init__(self, hconcat=Undefined, bounds=Undefined, center=Undefined, data=Undefined, - description=Undefined, name=Undefined, resolve=Undefined, spacing=Undefined, - title=Undefined, transform=Undefined, **kwds): - super(HConcatSpec, self).__init__(hconcat=hconcat, bounds=bounds, center=center, data=data, - description=description, name=name, resolve=resolve, - spacing=spacing, title=title, transform=transform, **kwds) + def __init__(self, autocomplete=Undefined, debounce=Undefined, element=Undefined, input=Undefined, + name=Undefined, placeholder=Undefined, type=Undefined, **kwds): + super(InputBinding, self).__init__(autocomplete=autocomplete, debounce=debounce, + element=element, input=input, name=name, + placeholder=placeholder, type=type, **kwds) -class RepeatSpec(VegaLiteSchema): - """RepeatSpec schema wrapper +class Interpolate(VegaLiteSchema): + """Interpolate schema wrapper - Mapping(required=[repeat, spec]) - Base interface for a repeat specification. + enum('linear', 'linear-closed', 'step', 'step-before', 'step-after', 'basis', 'basis-open', + 'basis-closed', 'cardinal', 'cardinal-open', 'cardinal-closed', 'bundle', 'monotone') + """ + _schema = {'$ref': '#/definitions/Interpolate'} + _rootschema = Root._schema - Attributes - ---------- + def __init__(self, *args): + super(Interpolate, self).__init__(*args) - repeat : anyOf(List(string), :class:`RepeatMapping`) - Definition for fields to be repeated. One of: - 1) An array of fields to be repeated. If ``"repeat"`` is an array, the field can be - referred using ``{"repeat": "repeat"}`` - 2) An object that mapped ``"row"`` and/or ``"column"`` to the listed of fields to be - repeated along the particular orientations. The objects ``{"repeat": "row"}`` and - ``{"repeat": "column"}`` can be used to refer to the repeated field respectively. - spec : :class:`Spec` - A specification of the view that gets repeated. - align : anyOf(:class:`LayoutAlign`, :class:`RowColLayoutAlign`) - The alignment to apply to grid rows and columns. - The supported string values are ``"all"``, ``"each"``, and ``"none"``. +class IntervalSelectionConfig(VegaLiteSchema): + """IntervalSelectionConfig schema wrapper - * 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. + Mapping(required=[]) - Alternatively, an object value of the form ``{"row": string, "column": string}`` can - be used to supply different alignments for rows and columns. + Attributes + ---------- - **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) or ``flush``. + 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. + **See also:** `bind `__ + documentation. + clear : anyOf(:class:`EventStream`, boolean) + Clears the selection, emptying it of all values. Can be an + `EventStream `__ or ``false`` to + disable. - * If set to ``full``, the entire calculated bounds (including axes, title, and - legend) will be used. - * If set to ``flush``, 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:** ``dblclick``. - **Default value:** ``"full"`` - center : anyOf(boolean, :class:`RowColboolean`) - Boolean flag indicating if subviews should be centered relative to their respective - rows or columns. + **See also:** `clear `__ + documentation. + 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(:class:`SingleDefUnitChannel`) + An array of encoding channels. The corresponding data field values + must match for a data tuple to fall within the selection. - An object value of the form ``{"row": boolean, "column": boolean}`` can be used to - supply different centering values for rows and columns. + **See also:** `encodings `__ + documentation. + fields : List(:class:`FieldName`) + An array of field names whose values must match for a data tuple to + fall within the selection. - **Default value:** ``false`` - columns : float - The number of columns to include in the view composition layout. + **See also:** `fields `__ + documentation. + init : :class:`SelectionInitIntervalMapping` + Initialize the selection with a mapping between `projected channels or field names + `__ and arrays of + initial values. - **Default value** : ``undefined`` -- An infinite number of columns (a single row) - will be assumed. This is equivalent to - ``hconcat`` (for ``concat`` ) and to using the ``column`` channel (for ``facet`` and - ``repeat`` ). + **See also:** `init `__ + documentation. + mark : :class:`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. - **Note** : + **See also:** `mark `__ + documentation. + on : :class:`EventStream` + A `Vega event stream `__ (object or + selector) that triggers the selection. + For interval selections, the event stream must specify a `start and end + `__. + resolve : :class:`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. - 1) This property is only for: + **See also:** `resolve + `__ documentation. + 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. - * the general (wrappable) ``concat`` operator (not ``hconcat`` / ``vconcat`` ) - * the ``facet`` and ``repeat`` operator with one field/repetition definition - (without row/column nesting) + **See also:** `translate `__ + documentation. + 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, + only ``wheel`` events are supported. - 2) Setting the ``columns`` to ``1`` is equivalent to ``vconcat`` (for ``concat`` ) - and to using the ``row`` channel (for ``facet`` and ``repeat`` ). - data : anyOf(:class:`Data`, None) - An object describing the data source. Set to ``null`` to ignore the parent's data - source. If no data is set, it is derived from the parent. - description : string - Description of this mark for commenting purpose. - name : string - Name of the visualization for later reference. - resolve : :class:`Resolve` - Scale, axis, and legend resolutions for view composition specifications. - spacing : anyOf(float, :class:`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:** ``true``, which corresponds to ``wheel!``. - **Default value** : Depends on ``"spacing"`` property of `the view composition - configuration `__ ( - ``20`` by default) - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`Transform`) - An array of data transformations such as filter and new field calculation. + **See also:** `zoom `__ + documentation. """ - _schema = {'$ref': '#/definitions/RepeatSpec'} + _schema = {'$ref': '#/definitions/IntervalSelectionConfig'} _rootschema = Root._schema - def __init__(self, repeat=Undefined, spec=Undefined, align=Undefined, bounds=Undefined, - center=Undefined, columns=Undefined, data=Undefined, description=Undefined, - name=Undefined, resolve=Undefined, spacing=Undefined, title=Undefined, - transform=Undefined, **kwds): - super(RepeatSpec, self).__init__(repeat=repeat, spec=spec, align=align, bounds=bounds, - center=center, columns=columns, data=data, - description=description, name=name, resolve=resolve, - spacing=spacing, title=title, transform=transform, **kwds) - + def __init__(self, bind=Undefined, clear=Undefined, empty=Undefined, encodings=Undefined, + fields=Undefined, init=Undefined, mark=Undefined, on=Undefined, resolve=Undefined, + translate=Undefined, zoom=Undefined, **kwds): + super(IntervalSelectionConfig, self).__init__(bind=bind, clear=clear, empty=empty, + encodings=encodings, fields=fields, init=init, + mark=mark, on=on, resolve=resolve, + translate=translate, zoom=zoom, **kwds) -class Spec(VegaLiteSchema): - """Spec schema wrapper - anyOf(:class:`FacetedUnitSpec`, :class:`LayerSpec`, :class:`FacetSpec`, :class:`RepeatSpec`, - :class:`ConcatSpec`, :class:`VConcatSpec`, :class:`HConcatSpec`) - Any specification in Vega-Lite. - """ - _schema = {'$ref': '#/definitions/Spec'} - _rootschema = Root._schema - - def __init__(self, *args, **kwds): - super(Spec, self).__init__(*args, **kwds) - - -class GenericUnitSpecEncodingAnyMark(VegaLiteSchema): - """GenericUnitSpecEncodingAnyMark schema wrapper +class JoinAggregateFieldDef(VegaLiteSchema): + """JoinAggregateFieldDef schema wrapper - Mapping(required=[mark]) - Base interface for a unit (single-view) specification. + Mapping(required=[op, as]) Attributes ---------- - mark : :class:`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 : anyOf(:class:`Data`, None) - An object describing the data source. Set to ``null`` to ignore the parent's data - source. If no data is set, it is derived from the parent. - description : string - Description of this mark for commenting purpose. - encoding : :class:`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`` is ``null``, the height will be the value of `config.view.height - `__. - * If no field is mapped to ``y`` channel, the ``height`` will be the value of - ``rangeStep``. - - **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. - name : string - Name of the visualization for later reference. - projection : :class:`Projection` - An object defining properties of geographic projection, which will be applied to - ``shape`` path for ``"geoshape"`` marks - and to ``latitude`` and ``"longitude"`` channels for other marks. - selection : Mapping(required=[]) - A key-value mapping between selection names and definitions. - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`Transform`) - An array of data transformations such as filter and new field calculation. - view : :class:`ViewBackground` - An object defining the view background's fill and stroke. - - **Default value:** none (transparent) - 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`` is ``null``, the width will be the value of `config.view.width - `__. - * If no field is mapped to ``x`` channel, the ``width`` will be the value of - `config.scale.textXRangeStep - `__ for - ``text`` mark and the value of ``rangeStep`` 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. + op : :class:`AggregateOp` + The aggregation operation to apply (e.g., sum, average or count). See the list of + all supported operations `here + `__. + field : :class:`FieldName` + The data field for which to compute the aggregate function. This can be omitted for + functions that do not operate over a field such as ``count``. + as : :class:`FieldName` + The output name for the join aggregate operation. """ - _schema = {'$ref': '#/definitions/GenericUnitSpec'} + _schema = {'$ref': '#/definitions/JoinAggregateFieldDef'} _rootschema = Root._schema - def __init__(self, mark=Undefined, data=Undefined, description=Undefined, encoding=Undefined, - height=Undefined, name=Undefined, projection=Undefined, selection=Undefined, - title=Undefined, transform=Undefined, view=Undefined, width=Undefined, **kwds): - super(GenericUnitSpecEncodingAnyMark, self).__init__(mark=mark, data=data, - description=description, encoding=encoding, - height=height, name=name, - projection=projection, selection=selection, - title=title, transform=transform, - view=view, width=width, **kwds) + def __init__(self, op=Undefined, field=Undefined, **kwds): + super(JoinAggregateFieldDef, self).__init__(op=op, field=field, **kwds) -class VConcatSpec(VegaLiteSchema): - """VConcatSpec schema wrapper +class JsonDataFormat(DataFormat): + """JsonDataFormat schema wrapper - Mapping(required=[vconcat]) - Base interface for a vertical concatenation specification. + Mapping(required=[]) Attributes ---------- - vconcat : List(:class:`Spec`) - A list of views to 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) or ``flush``. - - - * If set to ``full``, the entire calculated bounds (including axes, title, and - legend) will be used. - * If set to ``flush``, 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. + parse : anyOf(:class:`Parse`, None) + If set to ``null``, 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 the ``modified_on`` field + in each input record a Date value. - **Default value:** ``false`` - data : anyOf(:class:`Data`, None) - An object describing the data source. Set to ``null`` to ignore the parent's data - source. If no data is set, it is derived from the parent. - description : string - Description of this mark for commenting purpose. - name : string - Name of the visualization for later reference. - resolve : :class:`Resolve` - Scale, axis, and legend resolutions for view composition specifications. - spacing : float - The spacing in pixels between sub-views of the concat operator. + 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 retrieving + ``json.values.features`` + from the loaded JSON object. + type : enum('json') + Type of input data: ``"json"``, ``"csv"``, ``"tsv"``, ``"dsv"``. - **Default value** : ``10`` - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`Transform`) - An array of data transformations such as filter and new field calculation. + **Default value:** The default format type is determined by the extension of the + file URL. + If no extension is detected, ``"json"`` will be used by default. """ - _schema = {'$ref': '#/definitions/VConcatSpec'} + _schema = {'$ref': '#/definitions/JsonDataFormat'} _rootschema = Root._schema - def __init__(self, vconcat=Undefined, bounds=Undefined, center=Undefined, data=Undefined, - description=Undefined, name=Undefined, resolve=Undefined, spacing=Undefined, - title=Undefined, transform=Undefined, **kwds): - super(VConcatSpec, self).__init__(vconcat=vconcat, bounds=bounds, center=center, data=data, - description=description, name=name, resolve=resolve, - spacing=spacing, title=title, transform=transform, **kwds) - - -class GraticuleGenerator(VegaLiteSchema): - """GraticuleGenerator schema wrapper + def __init__(self, parse=Undefined, property=Undefined, type=Undefined, **kwds): + super(JsonDataFormat, self).__init__(parse=parse, property=property, type=type, **kwds) - Mapping(required=[graticule]) - Attributes - ---------- +class LabelOverlap(VegaLiteSchema): + """LabelOverlap schema wrapper - graticule : anyOf(enum(True), :class:`GraticuleParams`) - Generate graticule GeoJSON data for geographic reference lines. - name : string - Provide a placeholder name and bind data at runtime. + anyOf(boolean, enum('parity'), enum('greedy')) """ - _schema = {'$ref': '#/definitions/GraticuleGenerator'} + _schema = {'$ref': '#/definitions/LabelOverlap'} _rootschema = Root._schema - def __init__(self, graticule=Undefined, name=Undefined, **kwds): - super(GraticuleGenerator, self).__init__(graticule=graticule, name=name, **kwds) + def __init__(self, *args, **kwds): + super(LabelOverlap, self).__init__(*args, **kwds) -class GraticuleParams(VegaLiteSchema): - """GraticuleParams schema wrapper +class LatLongFieldDef(VegaLiteSchema): + """LatLongFieldDef schema wrapper Mapping(required=[]) Attributes ---------- - extent : List(List(float)) - Sets both the major and minor extents to the same values. - extentMajor : List(List(float)) - The major extent of the graticule as a two-element array of coordinates. - extentMinor : List(List(float)) - The minor extent of the graticule as a two-element array of coordinates. - precision : float - The precision of the graticule in degrees. + aggregate : :class:`Aggregate` + Aggregation function for the field + (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). - **Default value:** ``2.5`` - step : List(float) - Sets both the major and minor step angles to the same values. - stepMajor : List(float) - The major step angles of the graticule. + **Default value:** ``undefined`` (None) - **Default value:** ``[90, 360]`` - stepMinor : List(float) - The minor step angles of the graticule. + **See also:** `aggregate `__ + documentation. + bin : None + A flag for binning a ``quantitative`` field, `an object defining binning parameters + `__, or indicating that the + data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite ( + ``"binned"`` ). - **Default value:** ``[10, 10]`` - """ - _schema = {'$ref': '#/definitions/GraticuleParams'} - _rootschema = Root._schema - - def __init__(self, extent=Undefined, extentMajor=Undefined, extentMinor=Undefined, - precision=Undefined, step=Undefined, stepMajor=Undefined, stepMinor=Undefined, **kwds): - super(GraticuleParams, self).__init__(extent=extent, extentMajor=extentMajor, - extentMinor=extentMinor, precision=precision, step=step, - stepMajor=stepMajor, stepMinor=stepMinor, **kwds) - - -class Header(VegaLiteSchema): - """Header schema wrapper - - Mapping(required=[]) - Headers of row / column channels for faceted plots. - - Attributes - ---------- - - format : string - The text formatting pattern for labels of guides (axes, legends, headers) and text - marks. - - - * If the format type is ``"number"`` (e.g., for quantitative fields), this is D3's - `number format pattern `__. - * If the format type is ``"time"`` (e.g., for temporal fields), this is D3's `time - format pattern `__. - - See the `format documentation `__ - for more examples. - **Default value:** Derived from `numberFormat - `__ config for number - format and from `timeFormat - `__ config for time - format. - formatType : enum('number', 'time') - The format type for labels ( ``"number"`` or ``"time"`` ). + If ``true``, default `binning parameters + `__ will be applied. - **Default value:** + If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are + already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end + field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to + binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also + set the axis's `tickMinStep + `__ property. + **Default value:** ``false`` - * ``"time"`` for temporal fields and ordinal and nomimal fields with ``timeUnit``. - * ``"number"`` for quantitative fields as well as ordinal and nomimal fields without - ``timeUnit``. - labelAlign : :class:`Align` - Horizontal text alignment of header labels. - labelAnchor : :class:`TitleAnchor` - The anchor position for placing the labels. One of ``"start"``, ``"middle"``, or - ``"end"``. For example, with a label orientation of top these anchor positions map - to a left-, center-, or right-aligned label. - labelAngle : float - The rotation angle of the header labels. + **See also:** `bin `__ + documentation. + field : :class:`Field` + **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. - **Default value:** ``0`` for column header, ``-90`` for row header. - labelColor : :class:`Color` - 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. - labelFontStyle : :class:`FontStyle` - The font style of the header label. - 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. + **See also:** `field `__ + documentation. - **Default value:** ``0``, indicating no limit - labelOrient : :class:`Orient` - The orientation of the header label. One of ``"top"``, ``"bottom"``, ``"left"`` or - ``"right"``. - labelPadding : float - The padding, in pixel, between facet header's label and the plot. + **Notes:** + 1) 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 + `__. + 2) ``field`` is not required if ``aggregate`` is ``count``. + timeUnit : :class:`TimeUnit` + Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal + field. + or `a temporal field that gets casted as ordinal + `__. - **Default value:** ``10`` - labels : boolean - A boolean flag indicating if labels should be included as part of the header. + **Default value:** ``undefined`` (None) - **Default value:** ``true``. + **See also:** `timeUnit `__ + documentation. title : anyOf(string, None) A title for the field. If ``null``, the title will be removed. @@ -6731,80 +6329,108 @@ class Header(VegaLiteSchema): 2) If both field definition's ``title`` and axis, header, or legend ``title`` are defined, axis/header/legend title will be used. - titleAlign : :class:`Align` - Horizontal text alignment (to the anchor) of header titles. - titleAnchor : :class:`TitleAnchor` - 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. - titleAngle : float - The rotation angle of the header title. + type : enum('quantitative') + The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, + ``"ordinal"``, or ``"nominal"`` ). + It can also be a ``"geojson"`` type for encoding `'geoshape' + `__. - **Default value:** ``0``. - titleBaseline : :class:`TextBaseline` - Vertical text baseline for the header title. One of ``"top"``, ``"bottom"``, - ``"middle"``. + **Note:** - **Default value:** ``"middle"`` - titleColor : :class:`Color` - 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. - titleFontStyle : :class:`FontStyle` - The font style of the header title. - titleFontWeight : :class:`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 - titleOrient : :class:`Orient` - The orientation of the header title. One of ``"top"``, ``"bottom"``, ``"left"`` or - ``"right"``. - titlePadding : float - The padding, in pixel, between facet header's title and the label. + * Data values for a temporal field can be either a date-time string (e.g., + ``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a + timestamp number (e.g., ``1552199579097`` ). + * Data ``type`` describes the semantics of the data rather than the primitive data + types ( ``number``, ``string``, etc.). The same primitive data type can have + different types of measurement. For example, numeric data can represent + quantitative, ordinal, or nominal data. + * When using with `bin `__, the + ``type`` property can be either ``"quantitative"`` (for using a linear bin scale) + or `"ordinal" (for using an ordinal bin scale) + `__. + * When using with `timeUnit + `__, the ``type`` property + can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using + an ordinal scale) `__. + * When using with `aggregate + `__, the ``type`` property + refers to the post-aggregation data type. For example, we can calculate count + ``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct", + "field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output + is ``"quantitative"``. + * Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have + ``type`` as they have exactly the same type as their primary channels (e.g., + ``x``, ``y`` ). - **Default value:** ``10`` + **See also:** `type `__ + documentation. """ - _schema = {'$ref': '#/definitions/Header'} + _schema = {'$ref': '#/definitions/LatLongFieldDef'} _rootschema = Root._schema - def __init__(self, format=Undefined, formatType=Undefined, labelAlign=Undefined, - labelAnchor=Undefined, labelAngle=Undefined, labelColor=Undefined, labelFont=Undefined, - labelFontSize=Undefined, labelFontStyle=Undefined, labelLimit=Undefined, - labelOrient=Undefined, labelPadding=Undefined, labels=Undefined, title=Undefined, - titleAlign=Undefined, titleAnchor=Undefined, titleAngle=Undefined, - titleBaseline=Undefined, titleColor=Undefined, titleFont=Undefined, - titleFontSize=Undefined, titleFontStyle=Undefined, titleFontWeight=Undefined, - titleLimit=Undefined, titleOrient=Undefined, titlePadding=Undefined, **kwds): - super(Header, self).__init__(format=format, formatType=formatType, labelAlign=labelAlign, - labelAnchor=labelAnchor, labelAngle=labelAngle, - labelColor=labelColor, labelFont=labelFont, - labelFontSize=labelFontSize, labelFontStyle=labelFontStyle, - labelLimit=labelLimit, labelOrient=labelOrient, - labelPadding=labelPadding, labels=labels, title=title, - titleAlign=titleAlign, titleAnchor=titleAnchor, - titleAngle=titleAngle, titleBaseline=titleBaseline, - titleColor=titleColor, titleFont=titleFont, - titleFontSize=titleFontSize, titleFontStyle=titleFontStyle, - titleFontWeight=titleFontWeight, titleLimit=titleLimit, - titleOrient=titleOrient, titlePadding=titlePadding, **kwds) + def __init__(self, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, + title=Undefined, type=Undefined, **kwds): + super(LatLongFieldDef, self).__init__(aggregate=aggregate, bin=bin, field=field, + timeUnit=timeUnit, title=title, type=type, **kwds) -class HeaderConfig(VegaLiteSchema): - """HeaderConfig schema wrapper +class LayoutAlign(VegaLiteSchema): + """LayoutAlign schema wrapper + + enum('all', 'each', 'none') + """ + _schema = {'$ref': '#/definitions/LayoutAlign'} + _rootschema = Root._schema + + def __init__(self, *args): + super(LayoutAlign, self).__init__(*args) + + +class LayoutBounds(VegaLiteSchema): + """LayoutBounds schema wrapper + + anyOf(enum('full'), enum('flush'), :class:`SignalRef`) + """ + _schema = {'$ref': '#/definitions/LayoutBounds'} + _rootschema = Root._schema + + def __init__(self, *args, **kwds): + super(LayoutBounds, self).__init__(*args, **kwds) + + +class Legend(VegaLiteSchema): + """Legend schema wrapper Mapping(required=[]) + Properties of a legend or boolean flag for determining whether to show it. Attributes ---------- + clipHeight : float + The height in pixels to clip symbol legend entries and limit their size. + columnPadding : float + The horizontal padding in pixels between symbol legend entries. + + **Default value:** ``10``. + columns : float + The number of columns in which to arrange symbol legend entries. A value of ``0`` or + lower indicates a single row with one column per entry. + cornerRadius : float + Corner radius for the full legend. + direction : :class:`Orientation` + The direction of the legend, one of ``"vertical"`` or ``"horizontal"``. + + **Default value:** + + + * For top-/bottom- ``orient`` ed legends, ``"horizontal"`` + * For left-/right- ``orient`` ed legends, ``"vertical"`` + * For top/bottom-left/right- ``orient`` ed legends, ``"horizontal"`` for gradient + legends and ``"vertical"`` for symbol legends. + fillColor : :class:`Color` + Background fill color for the full legend. format : string The text formatting pattern for labels of guides (axes, legends, headers) and text marks. @@ -6832,1654 +6458,1316 @@ class HeaderConfig(VegaLiteSchema): * ``"time"`` for temporal fields and ordinal and nomimal fields with ``timeUnit``. * ``"number"`` for quantitative fields as well as ordinal and nomimal fields without ``timeUnit``. - labelAlign : :class:`Align` - Horizontal text alignment of header labels. - labelAnchor : :class:`TitleAnchor` - The anchor position for placing the labels. One of ``"start"``, ``"middle"``, or - ``"end"``. For example, with a label orientation of top these anchor positions map - to a left-, center-, or right-aligned label. - labelAngle : float - The rotation angle of the header labels. + gradientLength : float + The length in pixels of the primary axis of a color gradient. This value corresponds + to the height of a vertical gradient or the width of a horizontal gradient. - **Default value:** ``0`` for column header, ``-90`` for row header. + **Default value:** ``200``. + gradientOpacity : float + Opacity of the color gradient. + gradientStrokeColor : :class:`Color` + The color of the gradient stroke, can be in hex color code or regular color name. + + **Default value:** ``"lightGray"``. + gradientStrokeWidth : float + The width of the gradient stroke, in pixels. + + **Default value:** ``0``. + gradientThickness : float + The thickness in pixels of the color gradient. This value corresponds to the width + of a vertical gradient or the height of a horizontal gradient. + + **Default value:** ``16``. + gridAlign : :class:`LayoutAlign` + The alignment to apply to symbol legends rows and columns. The supported string + values are ``"all"``, ``"each"`` (the default), and ``none``. For more information, + see the `grid layout documentation `__. + + **Default value:** ``"each"``. + labelAlign : :class:`Align` + The alignment of the legend label, can be left, center, or right. + labelBaseline : :class:`TextBaseline` + The position of the baseline of legend label, can be ``"top"``, ``"middle"``, + ``"bottom"``, or ``"alphabetic"``. + + **Default value:** ``"middle"``. labelColor : :class:`Color` - The color of the header label, can be in hex color code or regular color name. + The color of the legend label, can be in hex color code or regular color name. labelFont : string - The font of the header label. + The font of the legend label. labelFontSize : float - The font size of the header label, in pixels. + The font size of legend label. + + **Default value:** ``10``. labelFontStyle : :class:`FontStyle` - The font style of the header label. + The font style of legend label. + labelFontWeight : :class:`FontWeight` + The font weight of legend label. 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. + Maximum allowed pixel width of legend tick labels. - **Default value:** ``0``, indicating no limit - labelOrient : :class:`Orient` - The orientation of the header label. One of ``"top"``, ``"bottom"``, ``"left"`` or - ``"right"``. + **Default value:** ``160``. + labelOffset : float + The offset of the legend label. + labelOpacity : float + Opacity of labels. + labelOverlap : :class:`LabelOverlap` + The strategy to use for resolving overlap of labels in gradient legends. If + ``false``, no overlap reduction is attempted. If set to ``true`` (default) or + ``"parity"``, a strategy of removing every other label is used. If set to + ``"greedy"``, a linear scan of the labels is performed, removing any label that + overlaps with the last visible label (this often works better for log-scaled axes). + + **Default value:** ``true``. labelPadding : float - The padding, in pixel, between facet header's label and the plot. + Padding in pixels between the legend and legend labels. + labelSeparation : float + The minimum separation that must be between label bounding boxes for them to be + considered non-overlapping (default ``0`` ). This property is ignored if + *labelOverlap* resolution is not enabled. + legendX : float + Custom x-position for legend with orient "none". + legendY : float + Custom y-position for legend with orient "none". + offset : float + The offset in pixels by which to displace the legend from the data rectangle and + axes. - **Default value:** ``10`` - labels : boolean - A boolean flag indicating if labels should be included as part of the header. + **Default value:** ``18``. + orient : :class:`LegendOrient` + The orientation of the legend, which determines how the legend is positioned within + the scene. One of ``"left"``, ``"right"``, ``"top"``, ``"bottom"``, ``"top-left"``, + ``"top-right"``, ``"bottom-left"``, ``"bottom-right"``, ``"none"``. - **Default value:** ``true``. - shortTimeLabels : boolean - Whether month names and weekday names should be abbreviated. + **Default value:** ``"right"`` + padding : float + The padding between the border and content of the legend group. - **Default value:** ``false`` - title : None - Set to null to disable title for the axis, legend, or header. - titleAlign : :class:`Align` - Horizontal text alignment (to the anchor) of header titles. - titleAnchor : :class:`TitleAnchor` - 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. - titleAngle : float - The rotation angle of the header title. + **Default value:** ``0``. + rowPadding : float + The vertical padding in pixels between symbol legend entries. + + **Default value:** ``2``. + strokeColor : :class:`Color` + Border stroke color for the full legend. + symbolDash : List(float) + An array of alternating [stroke, space] lengths for dashed symbol strokes. + symbolDashOffset : float + The pixel offset at which to start drawing with the symbol stroke dash array. + symbolFillColor : :class:`Color` + The color of the legend symbol, + symbolOffset : float + Horizontal pixel offset for legend symbols. **Default value:** ``0``. + symbolOpacity : float + Opacity of the legend symbols. + symbolSize : float + The size of the legend symbol, in pixels. + + **Default value:** ``100``. + symbolStrokeColor : :class:`Color` + Stroke color for legend symbols. + symbolStrokeWidth : float + The width of the symbol's stroke. + + **Default value:** ``1.5``. + symbolType : :class:`SymbolShape` + The symbol shape. One of the plotting shapes ``circle`` (default), ``square``, + ``cross``, ``diamond``, ``triangle-up``, ``triangle-down``, ``triangle-right``, or + ``triangle-left``, the line symbol ``stroke``, or one of the centered directional + shapes ``arrow``, ``wedge``, or ``triangle``. Alternatively, a custom `SVG path + string `__ can be + provided. For correct sizing, custom shape paths should be defined within a square + bounding box with coordinates ranging from -1 to 1 along both the x and y + dimensions. + + **Default value:** ``"circle"``. + tickCount : float + The desired number of tick values for quantitative legends. + tickMinStep : float + The minimum desired step between legend ticks, in terms of scale domain values. For + example, a value of ``1`` indicates that ticks should not be less than 1 unit apart. + If ``tickMinStep`` is specified, the ``tickCount`` value will be adjusted, if + necessary, to enforce the minimum step value. + + **Default value** : ``undefined`` + 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`` and ``timeUnit`` ). 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 legend ``title`` are + defined, axis/header/legend title will be used. + titleAlign : :class:`Align` + Horizontal text alignment for legend titles. + + **Default value:** ``"left"``. + titleAnchor : :class:`TitleAnchor` + Text anchor position for placing legend titles. titleBaseline : :class:`TextBaseline` - Vertical text baseline for the header title. One of ``"top"``, ``"bottom"``, - ``"middle"``. + Vertical text baseline for legend titles. - **Default value:** ``"middle"`` + **Default value:** ``"top"``. titleColor : :class:`Color` - Color of the header title, can be in hex color code or regular color name. + The color of the legend title, can be in hex color code or regular color name. titleFont : string - Font of the header title. (e.g., ``"Helvetica Neue"`` ). + The font of the legend title. titleFontSize : float - Font size of the header title. + The font size of the legend title. titleFontStyle : :class:`FontStyle` - The font style of the header title. + The font style of the legend title. titleFontWeight : :class:`FontWeight` - Font weight of the header title. + 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 - The maximum length of the header title in pixels. The text value will be - automatically truncated if the rendered size exceeds the limit. + Maximum allowed pixel width of legend titles. - **Default value:** ``0``, indicating no limit + **Default value:** ``180``. + titleOpacity : float + Opacity of the legend title. titleOrient : :class:`Orient` - The orientation of the header title. One of ``"top"``, ``"bottom"``, ``"left"`` or - ``"right"``. + Orientation of the legend title. titlePadding : float - The padding, in pixel, between facet header's title and the label. - - **Default value:** ``10`` - """ - _schema = {'$ref': '#/definitions/HeaderConfig'} - _rootschema = Root._schema - - def __init__(self, format=Undefined, formatType=Undefined, labelAlign=Undefined, - labelAnchor=Undefined, labelAngle=Undefined, labelColor=Undefined, labelFont=Undefined, - labelFontSize=Undefined, labelFontStyle=Undefined, labelLimit=Undefined, - labelOrient=Undefined, labelPadding=Undefined, labels=Undefined, - shortTimeLabels=Undefined, title=Undefined, titleAlign=Undefined, - titleAnchor=Undefined, titleAngle=Undefined, titleBaseline=Undefined, - titleColor=Undefined, titleFont=Undefined, titleFontSize=Undefined, - titleFontStyle=Undefined, titleFontWeight=Undefined, titleLimit=Undefined, - titleOrient=Undefined, titlePadding=Undefined, **kwds): - super(HeaderConfig, self).__init__(format=format, formatType=formatType, labelAlign=labelAlign, - labelAnchor=labelAnchor, labelAngle=labelAngle, - labelColor=labelColor, labelFont=labelFont, - labelFontSize=labelFontSize, labelFontStyle=labelFontStyle, - labelLimit=labelLimit, labelOrient=labelOrient, - labelPadding=labelPadding, labels=labels, - shortTimeLabels=shortTimeLabels, title=title, - titleAlign=titleAlign, titleAnchor=titleAnchor, - titleAngle=titleAngle, titleBaseline=titleBaseline, - titleColor=titleColor, titleFont=titleFont, - titleFontSize=titleFontSize, titleFontStyle=titleFontStyle, - titleFontWeight=titleFontWeight, titleLimit=titleLimit, - titleOrient=titleOrient, titlePadding=titlePadding, **kwds) - + The padding, in pixels, between title and legend. -class HexColor(VegaLiteSchema): - """HexColor schema wrapper + **Default value:** ``5``. + type : enum('symbol', 'gradient') + The type of the legend. Use ``"symbol"`` to create a discrete legend and + ``"gradient"`` for a continuous color gradient. - string + **Default value:** ``"gradient"`` for non-binned quantitative fields and temporal + fields; ``"symbol"`` otherwise. + values : List(anyOf(float, string, boolean, :class:`DateTime`)) + Explicitly set the visible legend values. + zindex : float + A non-negative integer indicating the 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. """ - _schema = {'$ref': '#/definitions/HexColor'} + _schema = {'$ref': '#/definitions/Legend'} _rootschema = Root._schema - def __init__(self, *args): - super(HexColor, self).__init__(*args) - - -class ImputeMethod(VegaLiteSchema): - """ImputeMethod schema wrapper - - enum('value', 'median', 'max', 'min', 'mean') - """ - _schema = {'$ref': '#/definitions/ImputeMethod'} - _rootschema = Root._schema - - def __init__(self, *args): - super(ImputeMethod, self).__init__(*args) + def __init__(self, clipHeight=Undefined, columnPadding=Undefined, columns=Undefined, + cornerRadius=Undefined, direction=Undefined, fillColor=Undefined, format=Undefined, + formatType=Undefined, gradientLength=Undefined, gradientOpacity=Undefined, + gradientStrokeColor=Undefined, gradientStrokeWidth=Undefined, + gradientThickness=Undefined, gridAlign=Undefined, labelAlign=Undefined, + labelBaseline=Undefined, labelColor=Undefined, labelFont=Undefined, + labelFontSize=Undefined, labelFontStyle=Undefined, labelFontWeight=Undefined, + labelLimit=Undefined, labelOffset=Undefined, labelOpacity=Undefined, + labelOverlap=Undefined, labelPadding=Undefined, labelSeparation=Undefined, + legendX=Undefined, legendY=Undefined, offset=Undefined, orient=Undefined, + padding=Undefined, rowPadding=Undefined, strokeColor=Undefined, symbolDash=Undefined, + symbolDashOffset=Undefined, symbolFillColor=Undefined, symbolOffset=Undefined, + symbolOpacity=Undefined, symbolSize=Undefined, symbolStrokeColor=Undefined, + symbolStrokeWidth=Undefined, symbolType=Undefined, tickCount=Undefined, + tickMinStep=Undefined, title=Undefined, titleAlign=Undefined, titleAnchor=Undefined, + titleBaseline=Undefined, titleColor=Undefined, titleFont=Undefined, + titleFontSize=Undefined, titleFontStyle=Undefined, titleFontWeight=Undefined, + titleLimit=Undefined, titleOpacity=Undefined, titleOrient=Undefined, + titlePadding=Undefined, type=Undefined, values=Undefined, zindex=Undefined, **kwds): + super(Legend, self).__init__(clipHeight=clipHeight, columnPadding=columnPadding, + columns=columns, cornerRadius=cornerRadius, direction=direction, + fillColor=fillColor, format=format, formatType=formatType, + gradientLength=gradientLength, gradientOpacity=gradientOpacity, + gradientStrokeColor=gradientStrokeColor, + gradientStrokeWidth=gradientStrokeWidth, + gradientThickness=gradientThickness, gridAlign=gridAlign, + labelAlign=labelAlign, labelBaseline=labelBaseline, + labelColor=labelColor, labelFont=labelFont, + labelFontSize=labelFontSize, labelFontStyle=labelFontStyle, + labelFontWeight=labelFontWeight, labelLimit=labelLimit, + labelOffset=labelOffset, labelOpacity=labelOpacity, + labelOverlap=labelOverlap, labelPadding=labelPadding, + labelSeparation=labelSeparation, legendX=legendX, legendY=legendY, + offset=offset, orient=orient, padding=padding, + rowPadding=rowPadding, strokeColor=strokeColor, + symbolDash=symbolDash, symbolDashOffset=symbolDashOffset, + symbolFillColor=symbolFillColor, symbolOffset=symbolOffset, + symbolOpacity=symbolOpacity, symbolSize=symbolSize, + symbolStrokeColor=symbolStrokeColor, + symbolStrokeWidth=symbolStrokeWidth, symbolType=symbolType, + tickCount=tickCount, tickMinStep=tickMinStep, title=title, + titleAlign=titleAlign, titleAnchor=titleAnchor, + titleBaseline=titleBaseline, titleColor=titleColor, + titleFont=titleFont, titleFontSize=titleFontSize, + titleFontStyle=titleFontStyle, titleFontWeight=titleFontWeight, + titleLimit=titleLimit, titleOpacity=titleOpacity, + titleOrient=titleOrient, titlePadding=titlePadding, type=type, + values=values, zindex=zindex, **kwds) -class ImputeParams(VegaLiteSchema): - """ImputeParams schema wrapper +class LegendConfig(VegaLiteSchema): + """LegendConfig schema wrapper Mapping(required=[]) Attributes ---------- - frame : List(anyOf(None, float)) - A frame specification as a two-element array used to control the window over which - the specified method is applied. 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. For example, the value ``[-5, - 5]`` indicates that the window should include five objects preceding and five - objects following the current object. - - **Default value:** : ``[null, null]`` indicating that the window includes all - objects. - keyvals : anyOf(List(Mapping(required=[])), :class:`ImputeSequence`) - Defines the key values that should be considered for imputation. - An array of key values or an object defining a `number sequence - `__. + clipHeight : float + The height in pixels to clip symbol legend entries and limit their size. + columnPadding : float + The horizontal padding in pixels between symbol legend entries. - If provided, this will be used in addition to the key values observed within the - input data. If not provided, the values will be derived from all unique values of - the ``key`` field. For ``impute`` in ``encoding``, the key field is the x-field if - the y-field is imputed, or vice versa. + **Default value:** ``10``. + columns : float + The number of columns in which to arrange symbol legend entries. A value of ``0`` or + lower indicates a single row with one column per entry. + cornerRadius : float + Corner radius for the full legend. + fillColor : :class:`Color` + Background fill color for the full legend. + gradientDirection : :class:`Orientation` + The default direction ( ``"horizontal"`` or ``"vertical"`` ) for gradient legends. - If there is no impute grouping, this property *must* be specified. - method : :class:`ImputeMethod` - The imputation method to use for the field value of imputed data objects. - One of ``value``, ``mean``, ``median``, ``max`` or ``min``. + **Default value:** ``"vertical"``. + gradientHorizontalMaxLength : float + Max legend length for a horizontal gradient when ``config.legend.gradientLength`` is + undefined. - **Default value:** ``"value"`` - value : Mapping(required=[]) - The field value to use when the imputation ``method`` is ``"value"``. - """ - _schema = {'$ref': '#/definitions/ImputeParams'} - _rootschema = Root._schema + **Default value:** ``200`` + gradientHorizontalMinLength : float + Min legend length for a horizontal gradient when ``config.legend.gradientLength`` is + undefined. - def __init__(self, frame=Undefined, keyvals=Undefined, method=Undefined, value=Undefined, **kwds): - super(ImputeParams, self).__init__(frame=frame, keyvals=keyvals, method=method, value=value, - **kwds) + **Default value:** ``100`` + gradientLabelLimit : float + The maximum allowed length in pixels of color ramp gradient labels. + gradientLabelOffset : float + Vertical offset in pixels for color ramp gradient labels. + **Default value:** ``2``. + gradientLength : float + The length in pixels of the primary axis of a color gradient. This value corresponds + to the height of a vertical gradient or the width of a horizontal gradient. -class ImputeSequence(VegaLiteSchema): - """ImputeSequence schema wrapper + **Default value:** ``200``. + gradientOpacity : float + Opacity of the color gradient. + gradientStrokeColor : :class:`Color` + The color of the gradient stroke, can be in hex color code or regular color name. - Mapping(required=[stop]) + **Default value:** ``"lightGray"``. + gradientStrokeWidth : float + The width of the gradient stroke, in pixels. - Attributes - ---------- + **Default value:** ``0``. + gradientThickness : float + The thickness in pixels of the color gradient. This value corresponds to the width + of a vertical gradient or the height of a horizontal gradient. - stop : float - The ending value(exclusive) of the sequence. - start : float - The starting value of the sequence. - **Default value:** ``0`` - step : float - The step value between sequence entries. - **Default value:** ``1`` or ``-1`` if ``stop < start`` - """ - _schema = {'$ref': '#/definitions/ImputeSequence'} - _rootschema = Root._schema + **Default value:** ``16``. + gradientVerticalMaxLength : float + Max legend length for a vertical gradient when ``config.legend.gradientLength`` is + undefined. - def __init__(self, stop=Undefined, start=Undefined, step=Undefined, **kwds): - super(ImputeSequence, self).__init__(stop=stop, start=start, step=step, **kwds) + **Default value:** ``200`` + gradientVerticalMinLength : float + Min legend length for a vertical gradient when ``config.legend.gradientLength`` is + undefined. + **Default value:** ``100`` + gridAlign : :class:`LayoutAlign` + The alignment to apply to symbol legends rows and columns. The supported string + values are ``"all"``, ``"each"`` (the default), and ``none``. For more information, + see the `grid layout documentation `__. -class ImputeTransform(VegaLiteSchema): - """ImputeTransform schema wrapper + **Default value:** ``"each"``. + labelAlign : :class:`Align` + The alignment of the legend label, can be left, center, or right. + labelBaseline : :class:`TextBaseline` + The position of the baseline of legend label, can be ``"top"``, ``"middle"``, + ``"bottom"``, or ``"alphabetic"``. - Mapping(required=[impute, key]) + **Default value:** ``"middle"``. + labelColor : :class:`Color` + 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. - Attributes - ---------- + **Default value:** ``10``. + labelFontStyle : :class:`FontStyle` + The font style of legend label. + labelFontWeight : :class:`FontWeight` + The font weight of legend label. + labelLimit : float + Maximum allowed pixel width of legend tick labels. - impute : :class:`FieldName` - The data field for which the missing values should be imputed. - key : :class:`FieldName` - A key field that uniquely identifies data objects within a group. - Missing key values (those occurring in the data but not in the current group) will - be imputed. - frame : List(anyOf(None, float)) - A frame specification as a two-element array used to control the window over which - the specified method is applied. 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. For example, the value ``[-5, - 5]`` indicates that the window should include five objects preceding and five - objects following the current object. + **Default value:** ``160``. + labelOffset : float + The offset of the legend label. + labelOpacity : float + Opacity of labels. + labelOverlap : :class:`LabelOverlap` + The strategy to use for resolving overlap of labels in gradient legends. If + ``false``, no overlap reduction is attempted. If set to ``true`` or ``"parity"``, a + strategy of removing every other label is used. If set to ``"greedy"``, a linear + scan of the labels is performed, removing any label that overlaps with the last + visible label (this often works better for log-scaled axes). - **Default value:** : ``[null, null]`` indicating that the window includes all - objects. - groupby : List(:class:`FieldName`) - An optional array of fields by which to group the values. - Imputation will then be performed on a per-group basis. - keyvals : anyOf(List(Mapping(required=[])), :class:`ImputeSequence`) - Defines the key values that should be considered for imputation. - An array of key values or an object defining a `number sequence - `__. + **Default value:** ``"greedy"`` for ``log scales otherwise`` true`. + labelPadding : float + Padding in pixels between the legend and legend labels. + labelSeparation : float + The minimum separation that must be between label bounding boxes for them to be + considered non-overlapping (default ``0`` ). This property is ignored if + *labelOverlap* resolution is not enabled. + layout : :class:`LegendLayout` + Legend orient group layout parameters. + legendX : float + Custom x-position for legend with orient "none". + legendY : float + Custom y-position for legend with orient "none". + offset : float + The offset in pixels by which to displace the legend from the data rectangle and + axes. - If provided, this will be used in addition to the key values observed within the - input data. If not provided, the values will be derived from all unique values of - the ``key`` field. For ``impute`` in ``encoding``, the key field is the x-field if - the y-field is imputed, or vice versa. + **Default value:** ``18``. + orient : :class:`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". - If there is no impute grouping, this property *must* be specified. - method : :class:`ImputeMethod` - The imputation method to use for the field value of imputed data objects. - One of ``value``, ``mean``, ``median``, ``max`` or ``min``. + **Default value:** ``"right"`` + padding : float + The padding between the border and content of the legend group. - **Default value:** ``"value"`` - value : Mapping(required=[]) - The field value to use when the imputation ``method`` is ``"value"``. - """ - _schema = {'$ref': '#/definitions/ImputeTransform'} - _rootschema = Root._schema + **Default value:** ``0``. + rowPadding : float + The vertical padding in pixels between symbol legend entries. - def __init__(self, impute=Undefined, key=Undefined, frame=Undefined, groupby=Undefined, - keyvals=Undefined, method=Undefined, value=Undefined, **kwds): - super(ImputeTransform, self).__init__(impute=impute, key=key, frame=frame, groupby=groupby, - keyvals=keyvals, method=method, value=value, **kwds) + **Default value:** ``2``. + shortTimeLabels : boolean + Whether month names and weekday names should be abbreviated. + **Default value:** ``false`` + strokeColor : :class:`Color` + 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. + symbolBaseFillColor : :class:`Color` + Default fill color for legend symbols. Only applied if there is no ``"fill"`` scale + color encoding for the legend. -class InlineData(VegaLiteSchema): - """InlineData schema wrapper + **Default value:** ``"transparent"``. + symbolBaseStrokeColor : :class:`Color` + Default stroke color for legend symbols. Only applied if there is no ``"fill"`` + scale color encoding for the legend. - Mapping(required=[values]) + **Default value:** ``"gray"``. + symbolDash : List(float) + An array of alternating [stroke, space] lengths for dashed symbol strokes. + symbolDashOffset : float + The pixel offset at which to start drawing with the symbol stroke dash array. + symbolDirection : :class:`Orientation` + The default direction ( ``"horizontal"`` or ``"vertical"`` ) for symbol legends. - Attributes - ---------- + **Default value:** ``"vertical"``. + symbolFillColor : :class:`Color` + The color of the legend symbol, + symbolOffset : float + Horizontal pixel offset for legend symbols. - values : :class:`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 : :class:`DataFormat` - An object that specifies the format for parsing the data. - name : string - Provide a placeholder name and bind data at runtime. - """ - _schema = {'$ref': '#/definitions/InlineData'} - _rootschema = Root._schema + **Default value:** ``0``. + symbolOpacity : float + Opacity of the legend symbols. + symbolSize : float + The size of the legend symbol, in pixels. - def __init__(self, values=Undefined, format=Undefined, name=Undefined, **kwds): - super(InlineData, self).__init__(values=values, format=format, name=name, **kwds) + **Default value:** ``100``. + symbolStrokeColor : :class:`Color` + Stroke color for legend symbols. + symbolStrokeWidth : float + The width of the symbol's stroke. + **Default value:** ``1.5``. + symbolType : :class:`SymbolShape` + The symbol shape. One of the plotting shapes ``circle`` (default), ``square``, + ``cross``, ``diamond``, ``triangle-up``, ``triangle-down``, ``triangle-right``, or + ``triangle-left``, the line symbol ``stroke``, or one of the centered directional + shapes ``arrow``, ``wedge``, or ``triangle``. Alternatively, a custom `SVG path + string `__ can be + provided. For correct sizing, custom shape paths should be defined within a square + bounding box with coordinates ranging from -1 to 1 along both the x and y + dimensions. -class InlineDataset(VegaLiteSchema): - """InlineDataset schema wrapper + **Default value:** ``"circle"``. + title : None + Set to null to disable title for the axis, legend, or header. + titleAlign : :class:`Align` + Horizontal text alignment for legend titles. - anyOf(List(float), List(string), List(boolean), List(Mapping(required=[])), string, - Mapping(required=[])) + **Default value:** ``"left"``. + titleAnchor : :class:`TitleAnchor` + Text anchor position for placing legend titles. + titleBaseline : :class:`TextBaseline` + Vertical text baseline for legend titles. + + **Default value:** ``"top"``. + titleColor : :class:`Color` + 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. + titleFontStyle : :class:`FontStyle` + The font style of the legend title. + titleFontWeight : :class:`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 legend titles. + + **Default value:** ``180``. + titleOpacity : float + Opacity of the legend title. + titleOrient : :class:`Orient` + Orientation of the legend title. + titlePadding : float + The padding, in pixels, between title and legend. + + **Default value:** ``5``. """ - _schema = {'$ref': '#/definitions/InlineDataset'} + _schema = {'$ref': '#/definitions/LegendConfig'} _rootschema = Root._schema - def __init__(self, *args, **kwds): - super(InlineDataset, self).__init__(*args, **kwds) + def __init__(self, clipHeight=Undefined, columnPadding=Undefined, columns=Undefined, + cornerRadius=Undefined, fillColor=Undefined, gradientDirection=Undefined, + gradientHorizontalMaxLength=Undefined, gradientHorizontalMinLength=Undefined, + gradientLabelLimit=Undefined, gradientLabelOffset=Undefined, gradientLength=Undefined, + gradientOpacity=Undefined, gradientStrokeColor=Undefined, + gradientStrokeWidth=Undefined, gradientThickness=Undefined, + gradientVerticalMaxLength=Undefined, gradientVerticalMinLength=Undefined, + gridAlign=Undefined, labelAlign=Undefined, labelBaseline=Undefined, + labelColor=Undefined, labelFont=Undefined, labelFontSize=Undefined, + labelFontStyle=Undefined, labelFontWeight=Undefined, labelLimit=Undefined, + labelOffset=Undefined, labelOpacity=Undefined, labelOverlap=Undefined, + labelPadding=Undefined, labelSeparation=Undefined, layout=Undefined, legendX=Undefined, + legendY=Undefined, offset=Undefined, orient=Undefined, padding=Undefined, + rowPadding=Undefined, shortTimeLabels=Undefined, strokeColor=Undefined, + strokeDash=Undefined, strokeWidth=Undefined, symbolBaseFillColor=Undefined, + symbolBaseStrokeColor=Undefined, symbolDash=Undefined, symbolDashOffset=Undefined, + symbolDirection=Undefined, symbolFillColor=Undefined, symbolOffset=Undefined, + symbolOpacity=Undefined, symbolSize=Undefined, symbolStrokeColor=Undefined, + symbolStrokeWidth=Undefined, symbolType=Undefined, title=Undefined, + titleAlign=Undefined, titleAnchor=Undefined, titleBaseline=Undefined, + titleColor=Undefined, titleFont=Undefined, titleFontSize=Undefined, + titleFontStyle=Undefined, titleFontWeight=Undefined, titleLimit=Undefined, + titleOpacity=Undefined, titleOrient=Undefined, titlePadding=Undefined, **kwds): + super(LegendConfig, self).__init__(clipHeight=clipHeight, columnPadding=columnPadding, + columns=columns, cornerRadius=cornerRadius, + fillColor=fillColor, gradientDirection=gradientDirection, + gradientHorizontalMaxLength=gradientHorizontalMaxLength, + gradientHorizontalMinLength=gradientHorizontalMinLength, + gradientLabelLimit=gradientLabelLimit, + gradientLabelOffset=gradientLabelOffset, + gradientLength=gradientLength, + gradientOpacity=gradientOpacity, + gradientStrokeColor=gradientStrokeColor, + gradientStrokeWidth=gradientStrokeWidth, + gradientThickness=gradientThickness, + gradientVerticalMaxLength=gradientVerticalMaxLength, + gradientVerticalMinLength=gradientVerticalMinLength, + gridAlign=gridAlign, labelAlign=labelAlign, + labelBaseline=labelBaseline, labelColor=labelColor, + labelFont=labelFont, labelFontSize=labelFontSize, + labelFontStyle=labelFontStyle, + labelFontWeight=labelFontWeight, labelLimit=labelLimit, + labelOffset=labelOffset, labelOpacity=labelOpacity, + labelOverlap=labelOverlap, labelPadding=labelPadding, + labelSeparation=labelSeparation, layout=layout, + legendX=legendX, legendY=legendY, offset=offset, + orient=orient, padding=padding, rowPadding=rowPadding, + shortTimeLabels=shortTimeLabels, strokeColor=strokeColor, + strokeDash=strokeDash, strokeWidth=strokeWidth, + symbolBaseFillColor=symbolBaseFillColor, + symbolBaseStrokeColor=symbolBaseStrokeColor, + symbolDash=symbolDash, symbolDashOffset=symbolDashOffset, + symbolDirection=symbolDirection, + symbolFillColor=symbolFillColor, symbolOffset=symbolOffset, + symbolOpacity=symbolOpacity, symbolSize=symbolSize, + symbolStrokeColor=symbolStrokeColor, + symbolStrokeWidth=symbolStrokeWidth, symbolType=symbolType, + title=title, titleAlign=titleAlign, titleAnchor=titleAnchor, + titleBaseline=titleBaseline, titleColor=titleColor, + titleFont=titleFont, titleFontSize=titleFontSize, + titleFontStyle=titleFontStyle, + titleFontWeight=titleFontWeight, titleLimit=titleLimit, + titleOpacity=titleOpacity, titleOrient=titleOrient, + titlePadding=titlePadding, **kwds) -class InputBinding(VegaLiteSchema): - """InputBinding schema wrapper +class LegendLayout(VegaLiteSchema): + """LegendLayout schema wrapper Mapping(required=[]) Attributes ---------- - autocomplete : string + anchor : :class:`TitleAnchor` + The anchor point for legend orient group layout. + bottom : :class:`BaseLegendLayout` - debounce : float + bounds : :class:`LayoutBounds` + The bounds calculation to use for legend orient group layout. + center : anyOf(boolean, :class:`SignalRef`) + A flag to center legends within a shared orient group. + direction : anyOf(:class:`Orientation`, :class:`SignalRef`) + The layout direction for legend orient group layout. + left : :class:`BaseLegendLayout` - element : :class:`Element` + margin : anyOf(float, :class:`SignalRef`) + The pixel margin between legends within a orient group. + offset : anyOf(float, :class:`SignalRef`) + The pixel offset from the chart body for a legend orient group. + right : :class:`BaseLegendLayout` - input : string + top : :class:`BaseLegendLayout` - name : string + bottom-left : :class:`BaseLegendLayout` - placeholder : string + bottom-right : :class:`BaseLegendLayout` - type : string + top-left : :class:`BaseLegendLayout` + + top-right : :class:`BaseLegendLayout` """ - _schema = {'$ref': '#/definitions/InputBinding'} + _schema = {'$ref': '#/definitions/LegendLayout'} _rootschema = Root._schema - def __init__(self, autocomplete=Undefined, debounce=Undefined, element=Undefined, input=Undefined, - name=Undefined, placeholder=Undefined, type=Undefined, **kwds): - super(InputBinding, self).__init__(autocomplete=autocomplete, debounce=debounce, - element=element, input=input, name=name, - placeholder=placeholder, type=type, **kwds) + def __init__(self, anchor=Undefined, bottom=Undefined, bounds=Undefined, center=Undefined, + direction=Undefined, left=Undefined, margin=Undefined, offset=Undefined, + right=Undefined, top=Undefined, **kwds): + super(LegendLayout, self).__init__(anchor=anchor, bottom=bottom, bounds=bounds, center=center, + direction=direction, left=left, margin=margin, offset=offset, + right=right, top=top, **kwds) -class Interpolate(VegaLiteSchema): - """Interpolate schema wrapper +class LegendOrient(VegaLiteSchema): + """LegendOrient schema wrapper - enum('linear', 'linear-closed', 'step', 'step-before', 'step-after', 'basis', 'basis-open', - 'basis-closed', 'cardinal', 'cardinal-open', 'cardinal-closed', 'bundle', 'monotone') + enum('none', 'left', 'right', 'top', 'bottom', 'top-left', 'top-right', 'bottom-left', + 'bottom-right') """ - _schema = {'$ref': '#/definitions/Interpolate'} + _schema = {'$ref': '#/definitions/LegendOrient'} _rootschema = Root._schema def __init__(self, *args): - super(Interpolate, self).__init__(*args) + super(LegendOrient, self).__init__(*args) -class IntervalSelection(VegaLiteSchema): - """IntervalSelection schema wrapper +class LegendResolveMap(VegaLiteSchema): + """LegendResolveMap schema wrapper - Mapping(required=[type]) + Mapping(required=[]) Attributes ---------- - type : enum('interval') - Determines the default event processing and data query for the selection. Vega-Lite - currently supports three selection types: + color : :class:`ResolveMode` + fill : :class:`ResolveMode` - * ``single`` -- to select a single discrete data value on ``click``. - * ``multi`` -- to select multiple discrete data value; the first value is selected - on ``click`` and additional values toggled on shift- ``click``. - * ``interval`` -- to select a continuous range of data values on ``drag``. - 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. - - **See also:** `bind `__ - documentation. - clear : anyOf(:class:`EventStream`, boolean) - Clears the selection, emptying it of all values. Can be an - `EventStream `__ or ``false`` to - disable. - - **Default value:** ``dblclick``. - - **See also:** `clear `__ - documentation. - 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(:class:`SingleDefUnitChannel`) - An array of encoding channels. The corresponding data field values - must match for a data tuple to fall within the selection. - - **See also:** `encodings `__ - documentation. - fields : List(:class:`FieldName`) - An array of field names whose values must match for a data tuple to - fall within the selection. - - **See also:** `fields `__ - documentation. - init : :class:`SelectionInitIntervalMapping` - Initialize the selection with a mapping between `projected channels or field names - `__ and arrays of - initial values. + fillOpacity : :class:`ResolveMode` - **See also:** `init `__ - documentation. - mark : :class:`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. + opacity : :class:`ResolveMode` - **See also:** `mark `__ - documentation. - on : :class:`EventStream` - A `Vega event stream `__ (object or - selector) that triggers the selection. - For interval selections, the event stream must specify a `start and end - `__. - resolve : :class:`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. + shape : :class:`ResolveMode` - **See also:** `resolve - `__ documentation. - 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. + size : :class:`ResolveMode` - **Default value:** ``true``, which corresponds to - ``[mousedown, window:mouseup] > window:mousemove!`` which corresponds to - clicks and dragging within an interval selection to reposition it. + stroke : :class:`ResolveMode` - **See also:** `translate `__ - documentation. - 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, - only ``wheel`` events are supported. + strokeOpacity : :class:`ResolveMode` - **Default value:** ``true``, which corresponds to ``wheel!``. + strokeWidth : :class:`ResolveMode` - **See also:** `zoom `__ - documentation. """ - _schema = {'$ref': '#/definitions/IntervalSelection'} + _schema = {'$ref': '#/definitions/LegendResolveMap'} _rootschema = Root._schema - def __init__(self, type=Undefined, bind=Undefined, clear=Undefined, empty=Undefined, - encodings=Undefined, fields=Undefined, init=Undefined, mark=Undefined, on=Undefined, - resolve=Undefined, translate=Undefined, zoom=Undefined, **kwds): - super(IntervalSelection, self).__init__(type=type, bind=bind, clear=clear, empty=empty, - encodings=encodings, fields=fields, init=init, - mark=mark, on=on, resolve=resolve, translate=translate, - zoom=zoom, **kwds) + def __init__(self, color=Undefined, fill=Undefined, fillOpacity=Undefined, opacity=Undefined, + shape=Undefined, size=Undefined, stroke=Undefined, strokeOpacity=Undefined, + strokeWidth=Undefined, **kwds): + super(LegendResolveMap, self).__init__(color=color, fill=fill, fillOpacity=fillOpacity, + opacity=opacity, shape=shape, size=size, stroke=stroke, + strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, + **kwds) -class IntervalSelectionConfig(VegaLiteSchema): - """IntervalSelectionConfig schema wrapper +class LineConfig(VegaLiteSchema): + """LineConfig 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. + align : :class:`Align` + The horizontal alignment of the text. One of ``"left"``, ``"right"``, ``"center"``. + angle : float + The rotation angle of the text, in degrees. + baseline : :class:`TextBaseline` + The vertical alignment of the text. One of ``"top"``, ``"middle"``, ``"bottom"``. - **See also:** `bind `__ - documentation. - clear : anyOf(:class:`EventStream`, boolean) - Clears the selection, emptying it of all values. Can be an - `EventStream `__ or ``false`` to - disable. + **Default value:** ``"middle"`` + color : :class:`Color` + Default color. Note that ``fill`` and ``stroke`` have higher precedence than + ``color`` and will override ``color``. - **Default value:** ``dblclick``. + **Default value:** :raw-html:`` + ``"#4682b4"`` - **See also:** `clear `__ - documentation. - 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(:class:`SingleDefUnitChannel`) - An array of encoding channels. The corresponding data field values - must match for a data tuple to fall within the selection. + **Note:** This property cannot be used in a `style config + `__. + cornerRadius : float + The radius in pixels of rounded rectangle corners. - **See also:** `encodings `__ - documentation. - fields : List(:class:`FieldName`) - An array of field names whose values must match for a data tuple to - fall within the selection. + **Default value:** ``0`` + cursor : :class:`Cursor` + The mouse cursor used over the mark. Any valid `CSS cursor type + `__ can be used. + dir : :class:`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. - **See also:** `fields `__ - documentation. - init : :class:`SelectionInitIntervalMapping` - Initialize the selection with a mapping between `projected channels or field names - `__ and arrays of - initial values. + **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. - **See also:** `init `__ - documentation. - mark : :class:`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. + **Default value:** ``"…"`` + fill : :class:`Color` + Default Fill Color. This has higher precedence than ``config.color`` - **See also:** `mark `__ - documentation. - on : :class:`EventStream` - A `Vega event stream `__ (object or - selector) that triggers the selection. - For interval selections, the event stream must specify a `start and end - `__. - resolve : :class:`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. + **Default value:** (None) + fillOpacity : float + The fill opacity (value between [0,1]). - **See also:** `resolve - `__ documentation. - 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:** ``1`` + filled : boolean + Whether the mark's color should be used as fill color instead of stroke color. - **Default value:** ``true``, which corresponds to - ``[mousedown, window:mouseup] > window:mousemove!`` which corresponds to - clicks and dragging within an interval selection to reposition it. + **Default value:** ``false`` for ``point``, ``line`` and ``rule`` ; otherwise, + ``true``. - **See also:** `translate `__ - documentation. - 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, - only ``wheel`` events are supported. + **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 : :class:`FontStyle` + The font style (e.g., ``"italic"`` ). + fontWeight : :class:`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`` + ). + height : float + Height of the marks. + href : string + A URL to load upon mouse click. If defined, the mark acts as a hyperlink. + interpolate : :class:`Interpolate` + The line interpolation method to use for line and area marks. One of the following: - **Default value:** ``true``, which corresponds to ``wheel!``. - **See also:** `zoom `__ - documentation. - """ - _schema = {'$ref': '#/definitions/IntervalSelectionConfig'} - _rootschema = Root._schema + * ``"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. - def __init__(self, bind=Undefined, clear=Undefined, empty=Undefined, encodings=Undefined, - fields=Undefined, init=Undefined, mark=Undefined, on=Undefined, resolve=Undefined, - translate=Undefined, zoom=Undefined, **kwds): - super(IntervalSelectionConfig, self).__init__(bind=bind, clear=clear, empty=empty, - encodings=encodings, fields=fields, init=init, - mark=mark, on=on, resolve=resolve, - translate=translate, zoom=zoom, **kwds) + **Default value:** ``0``, indicating no limit + opacity : float + The overall opacity (value between [0,1]). + **Default value:** ``0.7`` for non-aggregate plots with ``point``, ``tick``, + ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. + order : anyOf(None, boolean) + For line and trail marks, this ``order`` property can be set to ``null`` or + ``false`` to make the lines use the original order in the data sources. + orient : :class:`Orientation` + The orientation of a non-stacked bar, tick, area, and line charts. + The value is either horizontal (default) or vertical. -class JoinAggregateFieldDef(VegaLiteSchema): - """JoinAggregateFieldDef schema wrapper - Mapping(required=[op, as]) + * 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, :class:`OverlayMarkDef`, enum('transparent')) + A flag for overlaying points on top of line or area marks, or an object defining the + properties of the overlayed points. - Attributes - ---------- - op : :class:`AggregateOp` - The aggregation operation to apply (e.g., sum, average or count). See the list of - all supported operations `here - `__. - field : :class:`FieldName` - The data field for which to compute the aggregate function. This can be omitted for - functions that do not operate over a field such as ``count``. - as : :class:`FieldName` - The output name for the join aggregate operation. - """ - _schema = {'$ref': '#/definitions/JoinAggregateFieldDef'} - _rootschema = Root._schema + If this property is ``"transparent"``, transparent points will be used (for + enhancing tooltips and selections). - def __init__(self, op=Undefined, field=Undefined, **kwds): - super(JoinAggregateFieldDef, self).__init__(op=op, field=field, **kwds) + If this property is an empty object ( ``{}`` ) or ``true``, filled points with + default properties will be used. + If this property is ``false``, no points would be automatically added to line or + area marks. -class JoinAggregateTransform(VegaLiteSchema): - """JoinAggregateTransform schema wrapper + **Default value:** ``false``. + radius : float + Polar coordinate radial offset, in pixels, of the text label from the origin + determined by the ``x`` and ``y`` properties. + shape : string + Shape of the point marks. Supported values include: - Mapping(required=[joinaggregate]) - Attributes - ---------- + * plotting shapes: ``"circle"``, ``"square"``, ``"cross"``, ``"diamond"``, + ``"triangle-up"``, ``"triangle-down"``, ``"triangle-right"``, or + ``"triangle-left"``. + * the line symbol ``"stroke"`` + * centered directional shapes ``"arrow"``, ``"wedge"``, or ``"triangle"`` + * a custom `SVG path string + `__ (For correct + sizing, custom shape paths should be defined within a square bounding box with + coordinates ranging from -1 to 1 along both the x and y dimensions.) - joinaggregate : List(:class:`JoinAggregateFieldDef`) - The definition of the fields in the join aggregate, and what calculations to use. - groupby : List(:class:`FieldName`) - The data fields for partitioning the data objects into separate groups. If - unspecified, all data points will be in a single group. - """ - _schema = {'$ref': '#/definitions/JoinAggregateTransform'} - _rootschema = Root._schema + **Default value:** ``"circle"`` + size : float + Default size for marks. - def __init__(self, joinaggregate=Undefined, groupby=Undefined, **kwds): - super(JoinAggregateTransform, self).__init__(joinaggregate=joinaggregate, groupby=groupby, - **kwds) + * For ``point`` / ``circle`` / ``square``, this represents the pixel area of the + marks. For example: in the case of circles, the radius is determined in part by + the square root of the size value. + * For ``bar``, this represents the band size of the bar, in pixels. + * For ``text``, this represents the font size, in pixels. -class JsonDataFormat(VegaLiteSchema): - """JsonDataFormat schema wrapper + **Default value:** ``30`` for point, circle, square marks; ``rangeStep`` - 1 for bar + marks with discrete dimensions; ``5`` for bar marks with continuous dimensions; + ``11`` for text marks. + stroke : :class:`Color` + Default Stroke Color. This has higher precedence than ``config.color`` - Mapping(required=[]) + **Default value:** (None) + strokeCap : :class:`StrokeCap` + The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or + ``"square"``. - Attributes - ---------- + **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 : :class:`StrokeJoin` + The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. - parse : anyOf(:class:`Parse`, None) - If set to ``null``, 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 the ``modified_on`` field - in each input record a Date value. + **Default value:** ``"miter"`` + strokeMiterLimit : float + The miter limit at which to bevel a line join. + strokeOpacity : float + The stroke opacity (value between [0,1]). - 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 retrieving - ``json.values.features`` - from the loaded JSON object. - type : enum('json') - Type of input data: ``"json"``, ``"csv"``, ``"tsv"``, ``"dsv"``. + **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`` and ``y`` properties. Values for ``theta`` follow the same convention of + ``arc`` mark ``startAngle`` and ``endAngle`` properties: angles are measured in + radians, with ``0`` indicating "north". + tooltip : anyOf(:class:`Value`, :class:`TooltipContent`, None) + The tooltip text string to show upon mouse hover or an object defining which fields + should the tooltip be derived from. - **Default value:** The default format type is determined by the extension of the - file URL. - If no extension is detected, ``"json"`` will be used by default. + + * If ``tooltip`` is ``{"content": "encoding"}``, then all fields from ``encoding`` + will be used. + * If ``tooltip`` is ``{"content": "data"}``, then all fields that appear in the + highlighted data point will be used. + * If set to ``null``, then no tooltip will be used. + width : float + Width of the marks. + x : anyOf(float, enum('width')) + X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without + specified ``x2`` or ``width``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + x2 : anyOf(float, enum('width')) + X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + y : anyOf(float, enum('height')) + Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without + specified ``y2`` or ``height``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + y2 : anyOf(float, enum('width')) + Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. """ - _schema = {'$ref': '#/definitions/JsonDataFormat'} + _schema = {'$ref': '#/definitions/LineConfig'} _rootschema = Root._schema - def __init__(self, parse=Undefined, property=Undefined, type=Undefined, **kwds): - super(JsonDataFormat, self).__init__(parse=parse, property=property, type=type, **kwds) + def __init__(self, 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, + height=Undefined, href=Undefined, interpolate=Undefined, limit=Undefined, + opacity=Undefined, order=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, width=Undefined, x=Undefined, x2=Undefined, y=Undefined, + y2=Undefined, **kwds): + super(LineConfig, self).__init__(align=align, angle=angle, baseline=baseline, color=color, + cornerRadius=cornerRadius, cursor=cursor, dir=dir, dx=dx, + dy=dy, ellipsis=ellipsis, fill=fill, fillOpacity=fillOpacity, + filled=filled, font=font, fontSize=fontSize, + fontStyle=fontStyle, fontWeight=fontWeight, height=height, + href=href, interpolate=interpolate, limit=limit, + opacity=opacity, order=order, orient=orient, point=point, + radius=radius, shape=shape, size=size, stroke=stroke, + strokeCap=strokeCap, strokeDash=strokeDash, + strokeDashOffset=strokeDashOffset, strokeJoin=strokeJoin, + strokeMiterLimit=strokeMiterLimit, strokeOpacity=strokeOpacity, + strokeWidth=strokeWidth, tension=tension, text=text, + theta=theta, tooltip=tooltip, width=width, x=x, x2=x2, y=y, + y2=y2, **kwds) -class LabelOverlap(VegaLiteSchema): - """LabelOverlap schema wrapper +class LogicalOperandPredicate(VegaLiteSchema): + """LogicalOperandPredicate schema wrapper - anyOf(boolean, enum('parity'), enum('greedy')) + anyOf(:class:`LogicalNotPredicate`, :class:`LogicalAndPredicate`, + :class:`LogicalOrPredicate`, :class:`Predicate`) """ - _schema = {'$ref': '#/definitions/LabelOverlap'} + _schema = {'$ref': '#/definitions/LogicalOperand'} _rootschema = Root._schema def __init__(self, *args, **kwds): - super(LabelOverlap, self).__init__(*args, **kwds) + super(LogicalOperandPredicate, self).__init__(*args, **kwds) -class LatLongFieldDef(VegaLiteSchema): - """LatLongFieldDef schema wrapper +class LogicalAndPredicate(LogicalOperandPredicate): + """LogicalAndPredicate schema wrapper - Mapping(required=[]) + Mapping(required=[and]) Attributes ---------- - aggregate : :class:`Aggregate` - Aggregation function for the field - (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). + and : List(:class:`LogicalOperandPredicate`) - **Default value:** ``undefined`` (None) + """ + _schema = {'$ref': '#/definitions/LogicalAnd'} + _rootschema = Root._schema - **See also:** `aggregate `__ - documentation. - bin : None - A flag for binning a ``quantitative`` field, `an object defining binning parameters - `__, or indicating that the - data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite ( - ``"binned"`` ). + def __init__(self, **kwds): + super(LogicalAndPredicate, self).__init__(**kwds) - If ``true``, default `binning parameters - `__ will be applied. +class LogicalNotPredicate(LogicalOperandPredicate): + """LogicalNotPredicate schema wrapper - If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are - already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end - field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to - binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also - set the axis's `tickMinStep - `__ property. - - **Default value:** ``false`` - - **See also:** `bin `__ - documentation. - field : :class:`Field` - **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. - - **See also:** `field `__ - documentation. - - **Notes:** - 1) 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 - `__. - 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : :class:`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) - - **See also:** `timeUnit `__ - documentation. - 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`` and ``timeUnit`` ). 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 legend ``title`` are - defined, axis/header/legend title will be used. - type : enum('quantitative') - The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, - ``"ordinal"``, or ``"nominal"`` ). - It can also be a ``"geojson"`` type for encoding `'geoshape' - `__. - - **Note:** + Mapping(required=[not]) + Attributes + ---------- - * Data values for a temporal field can be either a date-time string (e.g., - ``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a - timestamp number (e.g., ``1552199579097`` ). - * Data ``type`` describes the semantics of the data rather than the primitive data - types ( ``number``, ``string``, etc.). The same primitive data type can have - different types of measurement. For example, numeric data can represent - quantitative, ordinal, or nominal data. - * When using with `bin `__, the - ``type`` property can be either ``"quantitative"`` (for using a linear bin scale) - or `"ordinal" (for using an ordinal bin scale) - `__. - * When using with `timeUnit - `__, the ``type`` property - can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using - an ordinal scale) `__. - * When using with `aggregate - `__, the ``type`` property - refers to the post-aggregation data type. For example, we can calculate count - ``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct", - "field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output - is ``"quantitative"``. - * Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have - ``type`` as they have exactly the same type as their primary channels (e.g., - ``x``, ``y`` ). + not : :class:`LogicalOperandPredicate` - **See also:** `type `__ - documentation. """ - _schema = {'$ref': '#/definitions/LatLongFieldDef'} + _schema = {'$ref': '#/definitions/LogicalNot'} _rootschema = Root._schema - def __init__(self, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, - title=Undefined, type=Undefined, **kwds): - super(LatLongFieldDef, self).__init__(aggregate=aggregate, bin=bin, field=field, - timeUnit=timeUnit, title=title, type=type, **kwds) + def __init__(self, **kwds): + super(LogicalNotPredicate, self).__init__(**kwds) -class LayerSpec(VegaLiteSchema): - """LayerSpec schema wrapper +class LogicalOrPredicate(LogicalOperandPredicate): + """LogicalOrPredicate schema wrapper - Mapping(required=[layer]) - A full layered plot specification, which may contains ``encoding`` and ``projection`` - properties that will be applied to underlying unit (single-view) specifications. + Mapping(required=[or]) Attributes ---------- - layer : List(anyOf(:class:`LayerSpec`, :class:`UnitSpec`)) - Layer or single view specifications to be layered. - - **Note** : Specifications inside ``layer`` cannot use ``row`` and ``column`` - channels as layering facet specifications is not allowed. Instead, use the `facet - operator `__ and place a layer - inside a facet. - data : anyOf(:class:`Data`, None) - An object describing the data source. Set to ``null`` to ignore the parent's data - source. If no data is set, it is derived from the parent. - description : string - Description of this mark for commenting purpose. - encoding : :class:`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`` is ``null``, the height will be the value of `config.view.height - `__. - * If no field is mapped to ``y`` channel, the ``height`` will be the value of - ``rangeStep``. - - **Note** : For plots with `row and column channels - `__, this represents the - height of a single view. + or : List(:class:`LogicalOperandPredicate`) - **See also:** The documentation for `width and height - `__ contains more examples. - name : string - Name of the visualization for later reference. - projection : :class:`Projection` - An object defining properties of the geographic projection shared by underlying - layers. - resolve : :class:`Resolve` - Scale, axis, and legend resolutions for view composition specifications. - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`Transform`) - An array of data transformations such as filter and new field calculation. - view : :class:`ViewBackground` - An object defining the view background's fill and stroke. + """ + _schema = {'$ref': '#/definitions/LogicalOr'} + _rootschema = Root._schema - **Default value:** none (transparent) - width : float - The width of a visualization. + def __init__(self, **kwds): + super(LogicalOrPredicate, self).__init__(**kwds) - **Default value:** This will be determined by the following rules: +class LookupData(VegaLiteSchema): + """LookupData schema wrapper - * 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`` is ``null``, the width will be the value of `config.view.width - `__. - * If no field is mapped to ``x`` channel, the ``width`` will be the value of - `config.scale.textXRangeStep - `__ for - ``text`` mark and the value of ``rangeStep`` for other marks. + Mapping(required=[data, key]) - **Note:** For plots with `row and column channels - `__, this represents the - width of a single view. + Attributes + ---------- - **See also:** The documentation for `width and height - `__ contains more examples. + data : :class:`Data` + Secondary data source to lookup in. + key : :class:`FieldName` + Key in data to lookup. + fields : List(:class:`FieldName`) + Fields in foreign data to lookup. + If not specified, the entire object is queried. """ - _schema = {'$ref': '#/definitions/LayerSpec'} + _schema = {'$ref': '#/definitions/LookupData'} _rootschema = Root._schema - def __init__(self, layer=Undefined, data=Undefined, description=Undefined, encoding=Undefined, - height=Undefined, name=Undefined, projection=Undefined, resolve=Undefined, - title=Undefined, transform=Undefined, view=Undefined, width=Undefined, **kwds): - super(LayerSpec, self).__init__(layer=layer, data=data, description=description, - encoding=encoding, height=height, name=name, - projection=projection, resolve=resolve, title=title, - transform=transform, view=view, width=width, **kwds) + def __init__(self, data=Undefined, key=Undefined, fields=Undefined, **kwds): + super(LookupData, self).__init__(data=data, key=key, fields=fields, **kwds) -class LayoutAlign(VegaLiteSchema): - """LayoutAlign schema wrapper +class Mark(AnyMark): + """Mark schema wrapper - enum('all', 'each', 'none') + enum('area', 'bar', 'line', 'trail', 'point', 'text', 'tick', 'rect', 'rule', 'circle', + 'square', 'geoshape') + All types of primitive marks. """ - _schema = {'$ref': '#/definitions/LayoutAlign'} + _schema = {'$ref': '#/definitions/Mark'} _rootschema = Root._schema def __init__(self, *args): - super(LayoutAlign, self).__init__(*args) - - -class LayoutBounds(VegaLiteSchema): - """LayoutBounds schema wrapper - - anyOf(enum('full'), enum('flush'), :class:`SignalRef`) - """ - _schema = {'$ref': '#/definitions/LayoutBounds'} - _rootschema = Root._schema - - def __init__(self, *args, **kwds): - super(LayoutBounds, self).__init__(*args, **kwds) + super(Mark, self).__init__(*args) -class Legend(VegaLiteSchema): - """Legend schema wrapper +class MarkConfig(VegaLiteSchema): + """MarkConfig schema wrapper Mapping(required=[]) - Properties of a legend or boolean flag for determining whether to show it. Attributes ---------- - clipHeight : float - The height in pixels to clip symbol legend entries and limit their size. - columnPadding : float - The horizontal padding in pixels between symbol legend entries. - - **Default value:** ``10``. - columns : float - The number of columns in which to arrange symbol legend entries. A value of ``0`` or - lower indicates a single row with one column per entry. - cornerRadius : float - Corner radius for the full legend. - direction : :class:`Orientation` - The direction of the legend, one of ``"vertical"`` or ``"horizontal"``. - - **Default value:** - - - * For top-/bottom- ``orient`` ed legends, ``"horizontal"`` - * For left-/right- ``orient`` ed legends, ``"vertical"`` - * For top/bottom-left/right- ``orient`` ed legends, ``"horizontal"`` for gradient - legends and ``"vertical"`` for symbol legends. - fillColor : :class:`Color` - Background fill color for the full legend. - format : string - The text formatting pattern for labels of guides (axes, legends, headers) and text - marks. - - - * If the format type is ``"number"`` (e.g., for quantitative fields), this is D3's - `number format pattern `__. - * If the format type is ``"time"`` (e.g., for temporal fields), this is D3's `time - format pattern `__. - - See the `format documentation `__ - for more examples. - - **Default value:** Derived from `numberFormat - `__ config for number - format and from `timeFormat - `__ config for time - format. - formatType : enum('number', 'time') - The format type for labels ( ``"number"`` or ``"time"`` ). - - **Default value:** - - - * ``"time"`` for temporal fields and ordinal and nomimal fields with ``timeUnit``. - * ``"number"`` for quantitative fields as well as ordinal and nomimal fields without - ``timeUnit``. - gradientLength : float - The length in pixels of the primary axis of a color gradient. This value corresponds - to the height of a vertical gradient or the width of a horizontal gradient. - - **Default value:** ``200``. - gradientOpacity : float - Opacity of the color gradient. - gradientStrokeColor : :class:`Color` - The color of the gradient stroke, can be in hex color code or regular color name. - - **Default value:** ``"lightGray"``. - gradientStrokeWidth : float - The width of the gradient stroke, in pixels. - - **Default value:** ``0``. - gradientThickness : float - The thickness in pixels of the color gradient. This value corresponds to the width - of a vertical gradient or the height of a horizontal gradient. - - **Default value:** ``16``. - gridAlign : :class:`LayoutAlign` - The alignment to apply to symbol legends rows and columns. The supported string - values are ``"all"``, ``"each"`` (the default), and ``none``. For more information, - see the `grid layout documentation `__. - - **Default value:** ``"each"``. - labelAlign : :class:`Align` - The alignment of the legend label, can be left, center, or right. - labelBaseline : :class:`TextBaseline` - The position of the baseline of legend label, can be ``"top"``, ``"middle"``, - ``"bottom"``, or ``"alphabetic"``. - - **Default value:** ``"middle"``. - labelColor : :class:`Color` - 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``. - labelFontStyle : :class:`FontStyle` - The font style of legend label. - labelFontWeight : :class:`FontWeight` - The font weight of legend label. - labelLimit : float - Maximum allowed pixel width of legend tick labels. - - **Default value:** ``160``. - labelOffset : float - The offset of the legend label. - labelOpacity : float - Opacity of labels. - labelOverlap : :class:`LabelOverlap` - The strategy to use for resolving overlap of labels in gradient legends. If - ``false``, no overlap reduction is attempted. If set to ``true`` (default) or - ``"parity"``, a strategy of removing every other label is used. If set to - ``"greedy"``, a linear scan of the labels is performed, removing any label that - overlaps with the last visible label (this often works better for log-scaled axes). - - **Default value:** ``true``. - labelPadding : float - Padding in pixels between the legend and legend labels. - labelSeparation : float - The minimum separation that must be between label bounding boxes for them to be - considered non-overlapping (default ``0`` ). This property is ignored if - *labelOverlap* resolution is not enabled. - legendX : float - Custom x-position for legend with orient "none". - legendY : float - Custom y-position for legend with orient "none". - offset : float - The offset in pixels by which to displace the legend from the data rectangle and - axes. - - **Default value:** ``18``. - orient : :class:`LegendOrient` - The orientation of the legend, which determines how the legend is positioned within - the scene. One of ``"left"``, ``"right"``, ``"top"``, ``"bottom"``, ``"top-left"``, - ``"top-right"``, ``"bottom-left"``, ``"bottom-right"``, ``"none"``. - - **Default value:** ``"right"`` - padding : float - The padding between the border and content of the legend group. - - **Default value:** ``0``. - rowPadding : float - The vertical padding in pixels between symbol legend entries. - - **Default value:** ``2``. - strokeColor : :class:`Color` - Border stroke color for the full legend. - symbolDash : List(float) - An array of alternating [stroke, space] lengths for dashed symbol strokes. - symbolDashOffset : float - The pixel offset at which to start drawing with the symbol stroke dash array. - symbolFillColor : :class:`Color` - The color of the legend symbol, - symbolOffset : float - Horizontal pixel offset for legend symbols. - - **Default value:** ``0``. - symbolOpacity : float - Opacity of the legend symbols. - symbolSize : float - The size of the legend symbol, in pixels. - - **Default value:** ``100``. - symbolStrokeColor : :class:`Color` - Stroke color for legend symbols. - symbolStrokeWidth : float - The width of the symbol's stroke. - - **Default value:** ``1.5``. - symbolType : :class:`SymbolShape` - The symbol shape. One of the plotting shapes ``circle`` (default), ``square``, - ``cross``, ``diamond``, ``triangle-up``, ``triangle-down``, ``triangle-right``, or - ``triangle-left``, the line symbol ``stroke``, or one of the centered directional - shapes ``arrow``, ``wedge``, or ``triangle``. Alternatively, a custom `SVG path - string `__ can be - provided. For correct sizing, custom shape paths should be defined within a square - bounding box with coordinates ranging from -1 to 1 along both the x and y - dimensions. - - **Default value:** ``"circle"``. - tickCount : float - The desired number of tick values for quantitative legends. - tickMinStep : float - The minimum desired step between legend ticks, in terms of scale domain values. For - example, a value of ``1`` indicates that ticks should not be less than 1 unit apart. - If ``tickMinStep`` is specified, the ``tickCount`` value will be adjusted, if - necessary, to enforce the minimum step value. - - **Default value** : ``undefined`` - 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`` and ``timeUnit`` ). 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 legend ``title`` are - defined, axis/header/legend title will be used. - titleAlign : :class:`Align` - Horizontal text alignment for legend titles. - - **Default value:** ``"left"``. - titleAnchor : :class:`TitleAnchor` - Text anchor position for placing legend titles. - titleBaseline : :class:`TextBaseline` - Vertical text baseline for legend titles. - - **Default value:** ``"top"``. - titleColor : :class:`Color` - 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. - titleFontStyle : :class:`FontStyle` - The font style of the legend title. - titleFontWeight : :class:`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 legend titles. - - **Default value:** ``180``. - titleOpacity : float - Opacity of the legend title. - titleOrient : :class:`Orient` - Orientation of the legend title. - titlePadding : float - The padding, in pixels, between title and legend. - - **Default value:** ``5``. - type : enum('symbol', 'gradient') - The type of the legend. Use ``"symbol"`` to create a discrete legend and - ``"gradient"`` for a continuous color gradient. - - **Default value:** ``"gradient"`` for non-binned quantitative fields and temporal - fields; ``"symbol"`` otherwise. - values : List(anyOf(float, string, boolean, :class:`DateTime`)) - Explicitly set the visible legend values. - zindex : float - A non-negative integer indicating the 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. - """ - _schema = {'$ref': '#/definitions/Legend'} - _rootschema = Root._schema - - def __init__(self, clipHeight=Undefined, columnPadding=Undefined, columns=Undefined, - cornerRadius=Undefined, direction=Undefined, fillColor=Undefined, format=Undefined, - formatType=Undefined, gradientLength=Undefined, gradientOpacity=Undefined, - gradientStrokeColor=Undefined, gradientStrokeWidth=Undefined, - gradientThickness=Undefined, gridAlign=Undefined, labelAlign=Undefined, - labelBaseline=Undefined, labelColor=Undefined, labelFont=Undefined, - labelFontSize=Undefined, labelFontStyle=Undefined, labelFontWeight=Undefined, - labelLimit=Undefined, labelOffset=Undefined, labelOpacity=Undefined, - labelOverlap=Undefined, labelPadding=Undefined, labelSeparation=Undefined, - legendX=Undefined, legendY=Undefined, offset=Undefined, orient=Undefined, - padding=Undefined, rowPadding=Undefined, strokeColor=Undefined, symbolDash=Undefined, - symbolDashOffset=Undefined, symbolFillColor=Undefined, symbolOffset=Undefined, - symbolOpacity=Undefined, symbolSize=Undefined, symbolStrokeColor=Undefined, - symbolStrokeWidth=Undefined, symbolType=Undefined, tickCount=Undefined, - tickMinStep=Undefined, title=Undefined, titleAlign=Undefined, titleAnchor=Undefined, - titleBaseline=Undefined, titleColor=Undefined, titleFont=Undefined, - titleFontSize=Undefined, titleFontStyle=Undefined, titleFontWeight=Undefined, - titleLimit=Undefined, titleOpacity=Undefined, titleOrient=Undefined, - titlePadding=Undefined, type=Undefined, values=Undefined, zindex=Undefined, **kwds): - super(Legend, self).__init__(clipHeight=clipHeight, columnPadding=columnPadding, - columns=columns, cornerRadius=cornerRadius, direction=direction, - fillColor=fillColor, format=format, formatType=formatType, - gradientLength=gradientLength, gradientOpacity=gradientOpacity, - gradientStrokeColor=gradientStrokeColor, - gradientStrokeWidth=gradientStrokeWidth, - gradientThickness=gradientThickness, gridAlign=gridAlign, - labelAlign=labelAlign, labelBaseline=labelBaseline, - labelColor=labelColor, labelFont=labelFont, - labelFontSize=labelFontSize, labelFontStyle=labelFontStyle, - labelFontWeight=labelFontWeight, labelLimit=labelLimit, - labelOffset=labelOffset, labelOpacity=labelOpacity, - labelOverlap=labelOverlap, labelPadding=labelPadding, - labelSeparation=labelSeparation, legendX=legendX, legendY=legendY, - offset=offset, orient=orient, padding=padding, - rowPadding=rowPadding, strokeColor=strokeColor, - symbolDash=symbolDash, symbolDashOffset=symbolDashOffset, - symbolFillColor=symbolFillColor, symbolOffset=symbolOffset, - symbolOpacity=symbolOpacity, symbolSize=symbolSize, - symbolStrokeColor=symbolStrokeColor, - symbolStrokeWidth=symbolStrokeWidth, symbolType=symbolType, - tickCount=tickCount, tickMinStep=tickMinStep, title=title, - titleAlign=titleAlign, titleAnchor=titleAnchor, - titleBaseline=titleBaseline, titleColor=titleColor, - titleFont=titleFont, titleFontSize=titleFontSize, - titleFontStyle=titleFontStyle, titleFontWeight=titleFontWeight, - titleLimit=titleLimit, titleOpacity=titleOpacity, - titleOrient=titleOrient, titlePadding=titlePadding, type=type, - values=values, zindex=zindex, **kwds) - - -class LegendConfig(VegaLiteSchema): - """LegendConfig schema wrapper - - Mapping(required=[]) - - Attributes - ---------- - - clipHeight : float - The height in pixels to clip symbol legend entries and limit their size. - columnPadding : float - The horizontal padding in pixels between symbol legend entries. - - **Default value:** ``10``. - columns : float - The number of columns in which to arrange symbol legend entries. A value of ``0`` or - lower indicates a single row with one column per entry. - cornerRadius : float - Corner radius for the full legend. - fillColor : :class:`Color` - Background fill color for the full legend. - gradientDirection : :class:`Orientation` - The default direction ( ``"horizontal"`` or ``"vertical"`` ) for gradient legends. - - **Default value:** ``"vertical"``. - gradientHorizontalMaxLength : float - Max legend length for a horizontal gradient when ``config.legend.gradientLength`` is - undefined. - - **Default value:** ``200`` - gradientHorizontalMinLength : float - Min legend length for a horizontal gradient when ``config.legend.gradientLength`` is - undefined. - - **Default value:** ``100`` - gradientLabelLimit : float - The maximum allowed length in pixels of color ramp gradient labels. - gradientLabelOffset : float - Vertical offset in pixels for color ramp gradient labels. - - **Default value:** ``2``. - gradientLength : float - The length in pixels of the primary axis of a color gradient. This value corresponds - to the height of a vertical gradient or the width of a horizontal gradient. - - **Default value:** ``200``. - gradientOpacity : float - Opacity of the color gradient. - gradientStrokeColor : :class:`Color` - The color of the gradient stroke, can be in hex color code or regular color name. - - **Default value:** ``"lightGray"``. - gradientStrokeWidth : float - The width of the gradient stroke, in pixels. - - **Default value:** ``0``. - gradientThickness : float - The thickness in pixels of the color gradient. This value corresponds to the width - of a vertical gradient or the height of a horizontal gradient. - - **Default value:** ``16``. - gradientVerticalMaxLength : float - Max legend length for a vertical gradient when ``config.legend.gradientLength`` is - undefined. - - **Default value:** ``200`` - gradientVerticalMinLength : float - Min legend length for a vertical gradient when ``config.legend.gradientLength`` is - undefined. - - **Default value:** ``100`` - gridAlign : :class:`LayoutAlign` - The alignment to apply to symbol legends rows and columns. The supported string - values are ``"all"``, ``"each"`` (the default), and ``none``. For more information, - see the `grid layout documentation `__. - - **Default value:** ``"each"``. - labelAlign : :class:`Align` - The alignment of the legend label, can be left, center, or right. - labelBaseline : :class:`TextBaseline` - The position of the baseline of legend label, can be ``"top"``, ``"middle"``, - ``"bottom"``, or ``"alphabetic"``. - - **Default value:** ``"middle"``. - labelColor : :class:`Color` - 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``. - labelFontStyle : :class:`FontStyle` - The font style of legend label. - labelFontWeight : :class:`FontWeight` - The font weight of legend label. - labelLimit : float - Maximum allowed pixel width of legend tick labels. - - **Default value:** ``160``. - labelOffset : float - The offset of the legend label. - labelOpacity : float - Opacity of labels. - labelOverlap : :class:`LabelOverlap` - The strategy to use for resolving overlap of labels in gradient legends. If - ``false``, no overlap reduction is attempted. If set to ``true`` or ``"parity"``, a - strategy of removing every other label is used. If set to ``"greedy"``, a linear - scan of the labels is performed, removing any label that overlaps with the last - visible label (this often works better for log-scaled axes). - - **Default value:** ``"greedy"`` for ``log scales otherwise`` true`. - labelPadding : float - Padding in pixels between the legend and legend labels. - labelSeparation : float - The minimum separation that must be between label bounding boxes for them to be - considered non-overlapping (default ``0`` ). This property is ignored if - *labelOverlap* resolution is not enabled. - layout : :class:`LegendLayout` - Legend orient group layout parameters. - legendX : float - Custom x-position for legend with orient "none". - legendY : float - Custom y-position for legend with orient "none". - offset : float - The offset in pixels by which to displace the legend from the data rectangle and - axes. - - **Default value:** ``18``. - orient : :class:`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 between the border and content of the legend group. - - **Default value:** ``0``. - rowPadding : float - The vertical padding in pixels between symbol legend entries. - - **Default value:** ``2``. - shortTimeLabels : boolean - Whether month names and weekday names should be abbreviated. - - **Default value:** ``false`` - strokeColor : :class:`Color` - 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. - symbolBaseFillColor : :class:`Color` - Default fill color for legend symbols. Only applied if there is no ``"fill"`` scale - color encoding for the legend. - - **Default value:** ``"transparent"``. - symbolBaseStrokeColor : :class:`Color` - Default stroke color for legend symbols. Only applied if there is no ``"fill"`` - scale color encoding for the legend. - - **Default value:** ``"gray"``. - symbolDash : List(float) - An array of alternating [stroke, space] lengths for dashed symbol strokes. - symbolDashOffset : float - The pixel offset at which to start drawing with the symbol stroke dash array. - symbolDirection : :class:`Orientation` - The default direction ( ``"horizontal"`` or ``"vertical"`` ) for symbol legends. - - **Default value:** ``"vertical"``. - symbolFillColor : :class:`Color` - The color of the legend symbol, - symbolOffset : float - Horizontal pixel offset for legend symbols. - - **Default value:** ``0``. - symbolOpacity : float - Opacity of the legend symbols. - symbolSize : float - The size of the legend symbol, in pixels. - - **Default value:** ``100``. - symbolStrokeColor : :class:`Color` - Stroke color for legend symbols. - symbolStrokeWidth : float - The width of the symbol's stroke. - - **Default value:** ``1.5``. - symbolType : :class:`SymbolShape` - The symbol shape. One of the plotting shapes ``circle`` (default), ``square``, - ``cross``, ``diamond``, ``triangle-up``, ``triangle-down``, ``triangle-right``, or - ``triangle-left``, the line symbol ``stroke``, or one of the centered directional - shapes ``arrow``, ``wedge``, or ``triangle``. Alternatively, a custom `SVG path - string `__ can be - provided. For correct sizing, custom shape paths should be defined within a square - bounding box with coordinates ranging from -1 to 1 along both the x and y - dimensions. - - **Default value:** ``"circle"``. - title : None - Set to null to disable title for the axis, legend, or header. - titleAlign : :class:`Align` - Horizontal text alignment for legend titles. - - **Default value:** ``"left"``. - titleAnchor : :class:`TitleAnchor` - Text anchor position for placing legend titles. - titleBaseline : :class:`TextBaseline` - Vertical text baseline for legend titles. - - **Default value:** ``"top"``. - titleColor : :class:`Color` - 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. - titleFontStyle : :class:`FontStyle` - The font style of the legend title. - titleFontWeight : :class:`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 legend titles. - - **Default value:** ``180``. - titleOpacity : float - Opacity of the legend title. - titleOrient : :class:`Orient` - Orientation of the legend title. - titlePadding : float - The padding, in pixels, between title and legend. - - **Default value:** ``5``. - """ - _schema = {'$ref': '#/definitions/LegendConfig'} - _rootschema = Root._schema - - def __init__(self, clipHeight=Undefined, columnPadding=Undefined, columns=Undefined, - cornerRadius=Undefined, fillColor=Undefined, gradientDirection=Undefined, - gradientHorizontalMaxLength=Undefined, gradientHorizontalMinLength=Undefined, - gradientLabelLimit=Undefined, gradientLabelOffset=Undefined, gradientLength=Undefined, - gradientOpacity=Undefined, gradientStrokeColor=Undefined, - gradientStrokeWidth=Undefined, gradientThickness=Undefined, - gradientVerticalMaxLength=Undefined, gradientVerticalMinLength=Undefined, - gridAlign=Undefined, labelAlign=Undefined, labelBaseline=Undefined, - labelColor=Undefined, labelFont=Undefined, labelFontSize=Undefined, - labelFontStyle=Undefined, labelFontWeight=Undefined, labelLimit=Undefined, - labelOffset=Undefined, labelOpacity=Undefined, labelOverlap=Undefined, - labelPadding=Undefined, labelSeparation=Undefined, layout=Undefined, legendX=Undefined, - legendY=Undefined, offset=Undefined, orient=Undefined, padding=Undefined, - rowPadding=Undefined, shortTimeLabels=Undefined, strokeColor=Undefined, - strokeDash=Undefined, strokeWidth=Undefined, symbolBaseFillColor=Undefined, - symbolBaseStrokeColor=Undefined, symbolDash=Undefined, symbolDashOffset=Undefined, - symbolDirection=Undefined, symbolFillColor=Undefined, symbolOffset=Undefined, - symbolOpacity=Undefined, symbolSize=Undefined, symbolStrokeColor=Undefined, - symbolStrokeWidth=Undefined, symbolType=Undefined, title=Undefined, - titleAlign=Undefined, titleAnchor=Undefined, titleBaseline=Undefined, - titleColor=Undefined, titleFont=Undefined, titleFontSize=Undefined, - titleFontStyle=Undefined, titleFontWeight=Undefined, titleLimit=Undefined, - titleOpacity=Undefined, titleOrient=Undefined, titlePadding=Undefined, **kwds): - super(LegendConfig, self).__init__(clipHeight=clipHeight, columnPadding=columnPadding, - columns=columns, cornerRadius=cornerRadius, - fillColor=fillColor, gradientDirection=gradientDirection, - gradientHorizontalMaxLength=gradientHorizontalMaxLength, - gradientHorizontalMinLength=gradientHorizontalMinLength, - gradientLabelLimit=gradientLabelLimit, - gradientLabelOffset=gradientLabelOffset, - gradientLength=gradientLength, - gradientOpacity=gradientOpacity, - gradientStrokeColor=gradientStrokeColor, - gradientStrokeWidth=gradientStrokeWidth, - gradientThickness=gradientThickness, - gradientVerticalMaxLength=gradientVerticalMaxLength, - gradientVerticalMinLength=gradientVerticalMinLength, - gridAlign=gridAlign, labelAlign=labelAlign, - labelBaseline=labelBaseline, labelColor=labelColor, - labelFont=labelFont, labelFontSize=labelFontSize, - labelFontStyle=labelFontStyle, - labelFontWeight=labelFontWeight, labelLimit=labelLimit, - labelOffset=labelOffset, labelOpacity=labelOpacity, - labelOverlap=labelOverlap, labelPadding=labelPadding, - labelSeparation=labelSeparation, layout=layout, - legendX=legendX, legendY=legendY, offset=offset, - orient=orient, padding=padding, rowPadding=rowPadding, - shortTimeLabels=shortTimeLabels, strokeColor=strokeColor, - strokeDash=strokeDash, strokeWidth=strokeWidth, - symbolBaseFillColor=symbolBaseFillColor, - symbolBaseStrokeColor=symbolBaseStrokeColor, - symbolDash=symbolDash, symbolDashOffset=symbolDashOffset, - symbolDirection=symbolDirection, - symbolFillColor=symbolFillColor, symbolOffset=symbolOffset, - symbolOpacity=symbolOpacity, symbolSize=symbolSize, - symbolStrokeColor=symbolStrokeColor, - symbolStrokeWidth=symbolStrokeWidth, symbolType=symbolType, - title=title, titleAlign=titleAlign, titleAnchor=titleAnchor, - titleBaseline=titleBaseline, titleColor=titleColor, - titleFont=titleFont, titleFontSize=titleFontSize, - titleFontStyle=titleFontStyle, - titleFontWeight=titleFontWeight, titleLimit=titleLimit, - titleOpacity=titleOpacity, titleOrient=titleOrient, - titlePadding=titlePadding, **kwds) + align : :class:`Align` + The horizontal alignment of the text. One of ``"left"``, ``"right"``, ``"center"``. + angle : float + The rotation angle of the text, in degrees. + baseline : :class:`TextBaseline` + The vertical alignment of the text. One of ``"top"``, ``"middle"``, ``"bottom"``. + **Default value:** ``"middle"`` + color : :class:`Color` + Default color. Note that ``fill`` and ``stroke`` have higher precedence than + ``color`` and will override ``color``. -class LegendLayout(VegaLiteSchema): - """LegendLayout schema wrapper + **Default value:** :raw-html:`` + ``"#4682b4"`` - Mapping(required=[]) + **Note:** This property cannot be used in a `style config + `__. + cornerRadius : float + The radius in pixels of rounded rectangle corners. - Attributes - ---------- + **Default value:** ``0`` + cursor : :class:`Cursor` + The mouse cursor used over the mark. Any valid `CSS cursor type + `__ can be used. + dir : :class:`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. - anchor : :class:`TitleAnchor` - The anchor point for legend orient group layout. - bottom : :class:`BaseLegendLayout` + **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. - bounds : :class:`LayoutBounds` - The bounds calculation to use for legend orient group layout. - center : anyOf(boolean, :class:`SignalRef`) - A flag to center legends within a shared orient group. - direction : anyOf(:class:`Orientation`, :class:`SignalRef`) - The layout direction for legend orient group layout. - left : :class:`BaseLegendLayout` + **Default value:** ``"…"`` + fill : :class:`Color` + Default Fill Color. This has higher precedence than ``config.color`` - margin : anyOf(float, :class:`SignalRef`) - The pixel margin between legends within a orient group. - offset : anyOf(float, :class:`SignalRef`) - The pixel offset from the chart body for a legend orient group. - right : :class:`BaseLegendLayout` + **Default value:** (None) + fillOpacity : float + The fill opacity (value between [0,1]). - top : :class:`BaseLegendLayout` + **Default value:** ``1`` + filled : boolean + Whether the mark's color should be used as fill color instead of stroke color. - bottom-left : :class:`BaseLegendLayout` + **Default value:** ``false`` for ``point``, ``line`` and ``rule`` ; otherwise, + ``true``. - bottom-right : :class:`BaseLegendLayout` + **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 : :class:`FontStyle` + The font style (e.g., ``"italic"`` ). + fontWeight : :class:`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`` + ). + height : float + Height of the marks. + href : string + A URL to load upon mouse click. If defined, the mark acts as a hyperlink. + interpolate : :class:`Interpolate` + The line interpolation method to use for line and area marks. One of the following: - top-left : :class:`BaseLegendLayout` - top-right : :class:`BaseLegendLayout` + * ``"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. - """ - _schema = {'$ref': '#/definitions/LegendLayout'} - _rootschema = Root._schema + **Default value:** ``0``, indicating no limit + opacity : float + The overall opacity (value between [0,1]). - def __init__(self, anchor=Undefined, bottom=Undefined, bounds=Undefined, center=Undefined, - direction=Undefined, left=Undefined, margin=Undefined, offset=Undefined, - right=Undefined, top=Undefined, **kwds): - super(LegendLayout, self).__init__(anchor=anchor, bottom=bottom, bounds=bounds, center=center, - direction=direction, left=left, margin=margin, offset=offset, - right=right, top=top, **kwds) + **Default value:** ``0.7`` for non-aggregate plots with ``point``, ``tick``, + ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. + order : anyOf(None, boolean) + For line and trail marks, this ``order`` property can be set to ``null`` or + ``false`` to make the lines use the original order in the data sources. + orient : :class:`Orientation` + The orientation of a non-stacked bar, tick, area, and line charts. + The value is either horizontal (default) or vertical. -class LegendOrient(VegaLiteSchema): - """LegendOrient schema wrapper + * 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`` and ``y`` properties. + shape : string + Shape of the point marks. Supported values include: - enum('none', 'left', 'right', 'top', 'bottom', 'top-left', 'top-right', 'bottom-left', - 'bottom-right') - """ - _schema = {'$ref': '#/definitions/LegendOrient'} - _rootschema = Root._schema - def __init__(self, *args): - super(LegendOrient, self).__init__(*args) + * plotting shapes: ``"circle"``, ``"square"``, ``"cross"``, ``"diamond"``, + ``"triangle-up"``, ``"triangle-down"``, ``"triangle-right"``, or + ``"triangle-left"``. + * the line symbol ``"stroke"`` + * centered directional shapes ``"arrow"``, ``"wedge"``, or ``"triangle"`` + * a custom `SVG path string + `__ (For correct + sizing, custom shape paths should be defined within a square bounding box with + coordinates ranging from -1 to 1 along both the x and y dimensions.) + **Default value:** ``"circle"`` + size : float + Default size for marks. -class LegendResolveMap(VegaLiteSchema): - """LegendResolveMap schema wrapper - Mapping(required=[]) + * For ``point`` / ``circle`` / ``square``, this represents the pixel area of the + marks. For example: in the case of circles, the radius is determined in part by + the square root of the size value. + * For ``bar``, this represents the band size of the bar, in pixels. + * For ``text``, this represents the font size, in pixels. - Attributes - ---------- + **Default value:** ``30`` for point, circle, square marks; ``rangeStep`` - 1 for bar + marks with discrete dimensions; ``5`` for bar marks with continuous dimensions; + ``11`` for text marks. + stroke : :class:`Color` + Default Stroke Color. This has higher precedence than ``config.color`` - color : :class:`ResolveMode` + **Default value:** (None) + strokeCap : :class:`StrokeCap` + The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or + ``"square"``. - fill : :class:`ResolveMode` + **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 : :class:`StrokeJoin` + The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. - fillOpacity : :class:`ResolveMode` + **Default value:** ``"miter"`` + strokeMiterLimit : float + The miter limit at which to bevel a line join. + strokeOpacity : float + The stroke opacity (value between [0,1]). - opacity : :class:`ResolveMode` + **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`` and ``y`` properties. Values for ``theta`` follow the same convention of + ``arc`` mark ``startAngle`` and ``endAngle`` properties: angles are measured in + radians, with ``0`` indicating "north". + tooltip : anyOf(:class:`Value`, :class:`TooltipContent`, None) + The tooltip text string to show upon mouse hover or an object defining which fields + should the tooltip be derived from. - shape : :class:`ResolveMode` - size : :class:`ResolveMode` + * If ``tooltip`` is ``{"content": "encoding"}``, then all fields from ``encoding`` + will be used. + * If ``tooltip`` is ``{"content": "data"}``, then all fields that appear in the + highlighted data point will be used. + * If set to ``null``, then no tooltip will be used. + width : float + Width of the marks. + x : anyOf(float, enum('width')) + X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without + specified ``x2`` or ``width``. - stroke : :class:`ResolveMode` + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + x2 : anyOf(float, enum('width')) + X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. - strokeOpacity : :class:`ResolveMode` + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + y : anyOf(float, enum('height')) + Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without + specified ``y2`` or ``height``. - strokeWidth : :class:`ResolveMode` + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + y2 : anyOf(float, enum('width')) + Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. """ - _schema = {'$ref': '#/definitions/LegendResolveMap'} + _schema = {'$ref': '#/definitions/MarkConfig'} _rootschema = Root._schema - def __init__(self, color=Undefined, fill=Undefined, fillOpacity=Undefined, opacity=Undefined, - shape=Undefined, size=Undefined, stroke=Undefined, strokeOpacity=Undefined, - strokeWidth=Undefined, **kwds): - super(LegendResolveMap, self).__init__(color=color, fill=fill, fillOpacity=fillOpacity, - opacity=opacity, shape=shape, size=size, stroke=stroke, - strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, - **kwds) + def __init__(self, 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, + height=Undefined, href=Undefined, interpolate=Undefined, limit=Undefined, + opacity=Undefined, order=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, width=Undefined, + x=Undefined, x2=Undefined, y=Undefined, y2=Undefined, **kwds): + super(MarkConfig, self).__init__(align=align, angle=angle, baseline=baseline, color=color, + cornerRadius=cornerRadius, cursor=cursor, dir=dir, dx=dx, + dy=dy, ellipsis=ellipsis, fill=fill, fillOpacity=fillOpacity, + filled=filled, font=font, fontSize=fontSize, + fontStyle=fontStyle, fontWeight=fontWeight, height=height, + href=href, interpolate=interpolate, limit=limit, + opacity=opacity, order=order, orient=orient, radius=radius, + shape=shape, size=size, stroke=stroke, strokeCap=strokeCap, + strokeDash=strokeDash, strokeDashOffset=strokeDashOffset, + strokeJoin=strokeJoin, strokeMiterLimit=strokeMiterLimit, + strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, + tension=tension, text=text, theta=theta, tooltip=tooltip, + width=width, x=x, x2=x2, y=y, y2=y2, **kwds) -class LineConfig(VegaLiteSchema): - """LineConfig schema wrapper +class MarkDef(AnyMark): + """MarkDef schema wrapper - Mapping(required=[]) + Mapping(required=[type]) Attributes ---------- + type : :class:`Mark` + The mark type. This could a primitive mark type + (one of ``"bar"``, ``"circle"``, ``"square"``, ``"tick"``, ``"line"``, + ``"area"``, ``"point"``, ``"geoshape"``, ``"rule"``, and ``"text"`` ) + or a composite mark type ( ``"boxplot"``, ``"errorband"``, ``"errorbar"`` ). align : :class:`Align` The horizontal alignment of the text. One of ``"left"``, ``"right"``, ``"center"``. angle : float @@ -8488,6 +7776,13 @@ class LineConfig(VegaLiteSchema): 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 : :class:`Color` Default color. Note that ``fill`` and ``stroke`` have higher precedence than ``color`` and will override ``color``. @@ -8578,6 +7873,17 @@ class LineConfig(VegaLiteSchema): truncated if the rendered size exceeds the limit. **Default value:** ``0``, indicating no limit + line : anyOf(boolean, :class:`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 ( ``{}`` ) or ``true``, 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]). @@ -8670,6 +7976,20 @@ class LineConfig(VegaLiteSchema): **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 from ``config.style.bar`` and + ``config.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). @@ -8680,6 +8000,10 @@ class LineConfig(VegaLiteSchema): the ``x`` and ``y`` properties. Values for ``theta`` follow the same convention of ``arc`` mark ``startAngle`` and ``endAngle`` properties: angles are measured in radians, with ``0`` indicating "north". + thickness : float + Thickness of the tick mark. + + **Default value:** ``1`` tooltip : anyOf(:class:`Value`, :class:`TooltipContent`, None) The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from. @@ -8703,6 +8027,10 @@ class LineConfig(VegaLiteSchema): The ``value`` of this channel can be a number or a string ``"width"`` for the width of the plot. + x2Offset : float + Offset for x2-position. + xOffset : float + Offset for x-position. y : anyOf(float, enum('height')) Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without specified ``y2`` or ``height``. @@ -8714,535 +8042,574 @@ class LineConfig(VegaLiteSchema): The ``value`` of this channel can be a number or a string ``"height"`` for the height of the plot. + y2Offset : float + Offset for y2-position. + yOffset : float + Offset for y-position. """ - _schema = {'$ref': '#/definitions/LineConfig'} + _schema = {'$ref': '#/definitions/MarkDef'} _rootschema = Root._schema - def __init__(self, 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, - height=Undefined, href=Undefined, interpolate=Undefined, limit=Undefined, + def __init__(self, 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, height=Undefined, + href=Undefined, interpolate=Undefined, limit=Undefined, line=Undefined, opacity=Undefined, order=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, width=Undefined, x=Undefined, x2=Undefined, y=Undefined, - y2=Undefined, **kwds): - super(LineConfig, self).__init__(align=align, angle=angle, baseline=baseline, color=color, - cornerRadius=cornerRadius, cursor=cursor, dir=dir, dx=dx, - dy=dy, ellipsis=ellipsis, fill=fill, fillOpacity=fillOpacity, - filled=filled, font=font, fontSize=fontSize, - fontStyle=fontStyle, fontWeight=fontWeight, height=height, - href=href, interpolate=interpolate, limit=limit, - opacity=opacity, order=order, orient=orient, point=point, - radius=radius, shape=shape, size=size, stroke=stroke, - strokeCap=strokeCap, strokeDash=strokeDash, - strokeDashOffset=strokeDashOffset, strokeJoin=strokeJoin, - strokeMiterLimit=strokeMiterLimit, strokeOpacity=strokeOpacity, - strokeWidth=strokeWidth, tension=tension, text=text, - theta=theta, tooltip=tooltip, width=width, x=x, x2=x2, y=y, - y2=y2, **kwds) - - -class LocalMultiTimeUnit(VegaLiteSchema): - """LocalMultiTimeUnit schema wrapper - - enum('yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', - 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'quartermonth', - 'monthdate', 'monthdatehours', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', - 'secondsmilliseconds') - """ - _schema = {'$ref': '#/definitions/LocalMultiTimeUnit'} - _rootschema = Root._schema - - def __init__(self, *args): - super(LocalMultiTimeUnit, self).__init__(*args) + strokeWidth=Undefined, style=Undefined, tension=Undefined, text=Undefined, + theta=Undefined, thickness=Undefined, tooltip=Undefined, width=Undefined, x=Undefined, + x2=Undefined, x2Offset=Undefined, xOffset=Undefined, y=Undefined, y2=Undefined, + y2Offset=Undefined, yOffset=Undefined, **kwds): + super(MarkDef, self).__init__(type=type, align=align, angle=angle, baseline=baseline, + binSpacing=binSpacing, clip=clip, color=color, + cornerRadius=cornerRadius, cursor=cursor, dir=dir, dx=dx, dy=dy, + ellipsis=ellipsis, fill=fill, fillOpacity=fillOpacity, + filled=filled, font=font, fontSize=fontSize, fontStyle=fontStyle, + fontWeight=fontWeight, height=height, href=href, + interpolate=interpolate, limit=limit, line=line, opacity=opacity, + order=order, orient=orient, point=point, radius=radius, + shape=shape, size=size, stroke=stroke, strokeCap=strokeCap, + strokeDash=strokeDash, strokeDashOffset=strokeDashOffset, + strokeJoin=strokeJoin, strokeMiterLimit=strokeMiterLimit, + strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, style=style, + tension=tension, text=text, theta=theta, thickness=thickness, + tooltip=tooltip, width=width, x=x, x2=x2, x2Offset=x2Offset, + xOffset=xOffset, y=y, y2=y2, y2Offset=y2Offset, yOffset=yOffset, + **kwds) -class LocalSingleTimeUnit(VegaLiteSchema): - """LocalSingleTimeUnit schema wrapper +class Month(VegaLiteSchema): + """Month schema wrapper - enum('year', 'quarter', 'month', 'day', 'date', 'hours', 'minutes', 'seconds', - 'milliseconds') + float """ - _schema = {'$ref': '#/definitions/LocalSingleTimeUnit'} + _schema = {'$ref': '#/definitions/Month'} _rootschema = Root._schema def __init__(self, *args): - super(LocalSingleTimeUnit, self).__init__(*args) + super(Month, self).__init__(*args) -class LogicalAndPredicate(VegaLiteSchema): - """LogicalAndPredicate schema wrapper +class MultiSelectionConfig(VegaLiteSchema): + """MultiSelectionConfig schema wrapper - Mapping(required=[and]) + Mapping(required=[]) Attributes ---------- - and : List(:class:`LogicalOperandPredicate`) + clear : anyOf(:class:`EventStream`, boolean) + Clears the selection, emptying it of all values. Can be an + `EventStream `__ or ``false`` to + disable. - """ - _schema = {'$ref': '#/definitions/LogicalAnd'} - _rootschema = Root._schema + **Default value:** ``dblclick``. - def __init__(self, **kwds): - super(LogicalAndPredicate, self).__init__(**kwds) + **See also:** `clear `__ + documentation. + 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(:class:`SingleDefUnitChannel`) + An array of encoding channels. The corresponding data field values + must match for a data tuple to fall within the selection. + **See also:** `encodings `__ + documentation. + fields : List(:class:`FieldName`) + An array of field names whose values must match for a data tuple to + fall within the selection. -class SelectionAnd(VegaLiteSchema): - """SelectionAnd schema wrapper + **See also:** `fields `__ + documentation. + init : anyOf(:class:`SelectionInitMapping`, List(:class:`SelectionInitMapping`)) + Initialize the selection with a mapping between `projected channels or field names + `__ and an initial + value (or array of values). - Mapping(required=[and]) + **See also:** `init `__ + documentation. + 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. - Attributes - ---------- + **See also:** `nearest `__ + documentation. + on : :class:`EventStream` + A `Vega event stream `__ (object or + selector) that triggers the selection. + For interval selections, the event stream must specify a `start and end + `__. + resolve : :class:`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. - and : List(:class:`SelectionOperand`) + **See also:** `resolve + `__ documentation. + 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 to ``event.shiftKey`` (i.e., + data values are toggled when a user interacts with the shift-key pressed). + + **See also:** `toggle `__ + documentation. """ - _schema = {'$ref': '#/definitions/SelectionAnd'} + _schema = {'$ref': '#/definitions/MultiSelectionConfig'} _rootschema = Root._schema - def __init__(self, **kwds): - super(SelectionAnd, self).__init__(**kwds) + def __init__(self, clear=Undefined, empty=Undefined, encodings=Undefined, fields=Undefined, + init=Undefined, nearest=Undefined, on=Undefined, resolve=Undefined, toggle=Undefined, + **kwds): + super(MultiSelectionConfig, self).__init__(clear=clear, empty=empty, encodings=encodings, + fields=fields, init=init, nearest=nearest, on=on, + resolve=resolve, toggle=toggle, **kwds) -class LogicalNotPredicate(VegaLiteSchema): - """LogicalNotPredicate schema wrapper +class NamedData(DataSource): + """NamedData schema wrapper - Mapping(required=[not]) + Mapping(required=[name]) Attributes ---------- - not : :class:`LogicalOperandPredicate` + name : string + Provide a placeholder name and bind data at runtime. + format : :class:`DataFormat` + An object that specifies the format for parsing the data. + """ + _schema = {'$ref': '#/definitions/NamedData'} + _rootschema = Root._schema + + def __init__(self, name=Undefined, format=Undefined, **kwds): + super(NamedData, self).__init__(name=name, format=format, **kwds) + + +class NiceTime(VegaLiteSchema): + """NiceTime schema wrapper + enum('second', 'minute', 'hour', 'day', 'week', 'month', 'year') """ - _schema = {'$ref': '#/definitions/LogicalNot'} + _schema = {'$ref': '#/definitions/NiceTime'} _rootschema = Root._schema - def __init__(self, **kwds): - super(LogicalNotPredicate, self).__init__(**kwds) + def __init__(self, *args): + super(NiceTime, self).__init__(*args) -class SelectionNot(VegaLiteSchema): - """SelectionNot schema wrapper +class NumberValueDef(VegaLiteSchema): + """NumberValueDef schema wrapper - Mapping(required=[not]) + Mapping(required=[value]) + Definition object for a constant value of an encoding channel. Attributes ---------- - not : :class:`SelectionOperand` - + value : float + A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values + between ``0`` to ``1`` for opacity). """ - _schema = {'$ref': '#/definitions/SelectionNot'} + _schema = {'$ref': '#/definitions/NumberValueDef'} _rootschema = Root._schema - def __init__(self, **kwds): - super(SelectionNot, self).__init__(**kwds) - + def __init__(self, value=Undefined, **kwds): + super(NumberValueDef, self).__init__(value=value, **kwds) -class LogicalOperandPredicate(VegaLiteSchema): - """LogicalOperandPredicate schema wrapper - anyOf(:class:`LogicalNotPredicate`, :class:`LogicalAndPredicate`, - :class:`LogicalOrPredicate`, :class:`Predicate`) - """ - _schema = {'$ref': '#/definitions/LogicalOperand'} - _rootschema = Root._schema +class NumericFieldDefWithCondition(VegaLiteSchema): + """NumericFieldDefWithCondition schema wrapper - def __init__(self, *args, **kwds): - super(LogicalOperandPredicate, self).__init__(*args, **kwds) + Mapping(required=[type]) + A FieldDef with Condition :raw-html:`` + Attributes + ---------- -class SelectionOperand(VegaLiteSchema): - """SelectionOperand schema wrapper + type : :class:`StandardType` + The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, + ``"ordinal"``, or ``"nominal"`` ). + It can also be a ``"geojson"`` type for encoding `'geoshape' + `__. - anyOf(:class:`SelectionNot`, :class:`SelectionAnd`, :class:`SelectionOr`, string) - """ - _schema = {'$ref': '#/definitions/SelectionOperand'} - _rootschema = Root._schema + **Note:** - def __init__(self, *args, **kwds): - super(SelectionOperand, self).__init__(*args, **kwds) + * Data values for a temporal field can be either a date-time string (e.g., + ``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a + timestamp number (e.g., ``1552199579097`` ). + * Data ``type`` describes the semantics of the data rather than the primitive data + types ( ``number``, ``string``, etc.). The same primitive data type can have + different types of measurement. For example, numeric data can represent + quantitative, ordinal, or nominal data. + * When using with `bin `__, the + ``type`` property can be either ``"quantitative"`` (for using a linear bin scale) + or `"ordinal" (for using an ordinal bin scale) + `__. + * When using with `timeUnit + `__, the ``type`` property + can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using + an ordinal scale) `__. + * When using with `aggregate + `__, the ``type`` property + refers to the post-aggregation data type. For example, we can calculate count + ``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct", + "field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output + is ``"quantitative"``. + * Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have + ``type`` as they have exactly the same type as their primary channels (e.g., + ``x``, ``y`` ). -class LogicalOrPredicate(VegaLiteSchema): - """LogicalOrPredicate schema wrapper + **See also:** `type `__ + documentation. + aggregate : :class:`Aggregate` + Aggregation function for the field + (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). - Mapping(required=[or]) + **Default value:** ``undefined`` (None) - Attributes - ---------- + **See also:** `aggregate `__ + documentation. + bin : anyOf(boolean, :class:`BinParams`, None) + A flag for binning a ``quantitative`` field, `an object defining binning parameters + `__, or indicating that the + data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite ( + ``"binned"`` ). - or : List(:class:`LogicalOperandPredicate`) - """ - _schema = {'$ref': '#/definitions/LogicalOr'} - _rootschema = Root._schema + If ``true``, default `binning parameters + `__ will be applied. - def __init__(self, **kwds): - super(LogicalOrPredicate, self).__init__(**kwds) + If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are + already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end + field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to + binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also + set the axis's `tickMinStep + `__ property. + **Default value:** ``false`` -class SelectionOr(VegaLiteSchema): - """SelectionOr schema wrapper + **See also:** `bin `__ + documentation. + condition : anyOf(:class:`ConditionalNumberValueDef`, + List(:class:`ConditionalNumberValueDef`)) + One or more value definition(s) with `a selection or a test predicate + `__. - Mapping(required=[or]) + **Note:** A field definition's ``condition`` property can only contain `conditional + value definitions `__ + since Vega-Lite only allows at most one encoded field per encoding channel. + field : :class:`Field` + **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. - Attributes - ---------- + **See also:** `field `__ + documentation. - or : List(:class:`SelectionOperand`) + **Notes:** + 1) 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 + `__. + 2) ``field`` is not required if ``aggregate`` is ``count``. + legend : anyOf(:class:`Legend`, None) + An object defining properties of the legend. + If ``null``, the legend for the encoding channel will be removed. - """ - _schema = {'$ref': '#/definitions/SelectionOr'} - _rootschema = Root._schema + **Default value:** If undefined, default `legend properties + `__ are applied. - def __init__(self, **kwds): - super(SelectionOr, self).__init__(**kwds) + **See also:** `legend `__ + documentation. + scale : anyOf(:class:`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 + `__. -class LookupData(VegaLiteSchema): - """LookupData schema wrapper + **Default value:** If undefined, default `scale properties + `__ are applied. - Mapping(required=[data, key]) + **See also:** `scale `__ + documentation. + sort : :class:`Sort` + Sort order for the encoded field. - Attributes - ---------- + For continuous fields (quantitative or temporal), ``sort`` can be either + ``"ascending"`` or ``"descending"``. - data : :class:`Data` - Secondary data source to lookup in. - key : :class:`FieldName` - Key in data to lookup. - fields : List(:class:`FieldName`) - Fields in foreign data to lookup. - If not specified, the entire object is queried. - """ - _schema = {'$ref': '#/definitions/LookupData'} - _rootschema = Root._schema + For discrete fields, ``sort`` can be one of the following: - def __init__(self, data=Undefined, key=Undefined, fields=Undefined, **kwds): - super(LookupData, self).__init__(data=data, key=key, fields=fields, **kwds) + * ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in + Javascript. + * `A sort-by-encoding definition + `__ for sorting + by another encoding channel. (This type of sort definition is not available for + ``row`` and ``column`` channels.) + * `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. -class LookupTransform(VegaLiteSchema): - """LookupTransform schema wrapper + **Default value:** ``"ascending"`` - Mapping(required=[lookup, from]) + **Note:** ``null`` is not supported for ``row`` and ``column``. - Attributes - ---------- + **See also:** `sort `__ + documentation. + timeUnit : :class:`TimeUnit` + Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal + field. + or `a temporal field that gets casted as ordinal + `__. - lookup : :class:`FieldName` - Key in primary data source. - default : string - The default value to use if lookup fails. + **Default value:** ``undefined`` (None) - **Default value:** ``null`` - as : anyOf(:class:`FieldName`, List(:class:`FieldName`)) - 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 : :class:`LookupData` - Secondary data reference. - """ - _schema = {'$ref': '#/definitions/LookupTransform'} - _rootschema = Root._schema + **See also:** `timeUnit `__ + documentation. + title : anyOf(string, None) + A title for the field. If ``null``, the title will be removed. - def __init__(self, lookup=Undefined, default=Undefined, **kwds): - super(LookupTransform, self).__init__(lookup=lookup, default=default, **kwds) + **Default value:** derived from the field's name and transformation function ( + ``aggregate``, ``bin`` and ``timeUnit`` ). 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** : -class Mark(VegaLiteSchema): - """Mark schema wrapper + 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 + `__. - enum('area', 'bar', 'line', 'trail', 'point', 'text', 'tick', 'rect', 'rule', 'circle', - 'square', 'geoshape') - All types of primitive marks. + 2) If both field definition's ``title`` and axis, header, or legend ``title`` are + defined, axis/header/legend title will be used. """ - _schema = {'$ref': '#/definitions/Mark'} + _schema = {'$ref': '#/definitions/NumericFieldDefWithCondition'} _rootschema = Root._schema - def __init__(self, *args): - super(Mark, self).__init__(*args) + def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, + field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, + title=Undefined, **kwds): + super(NumericFieldDefWithCondition, self).__init__(type=type, aggregate=aggregate, bin=bin, + condition=condition, field=field, + legend=legend, scale=scale, sort=sort, + timeUnit=timeUnit, title=title, **kwds) -class MarkConfig(VegaLiteSchema): - """MarkConfig schema wrapper +class NumericValueDefWithCondition(VegaLiteSchema): + """NumericValueDefWithCondition schema wrapper Mapping(required=[]) + A ValueDef with Condition where either the condition or the value are + optional. Attributes ---------- - align : :class:`Align` - The horizontal alignment of the text. One of ``"left"``, ``"right"``, ``"center"``. - angle : float - The rotation angle of the text, in degrees. - baseline : :class:`TextBaseline` - The vertical alignment of the text. One of ``"top"``, ``"middle"``, ``"bottom"``. + condition : anyOf(:class:`ConditionalMarkPropFieldDef`, :class:`ConditionalNumberValueDef`, + List(:class:`ConditionalNumberValueDef`)) + A field definition or one or more value definition(s) with a selection predicate. + value : float + A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values + between ``0`` to ``1`` for opacity). + """ + _schema = {'$ref': '#/definitions/NumericValueDefWithCondition'} + _rootschema = Root._schema - **Default value:** ``"middle"`` - color : :class:`Color` - Default color. Note that ``fill`` and ``stroke`` have higher precedence than - ``color`` and will override ``color``. + def __init__(self, condition=Undefined, value=Undefined, **kwds): + super(NumericValueDefWithCondition, self).__init__(condition=condition, value=value, **kwds) - **Default value:** :raw-html:`` - ``"#4682b4"`` - **Note:** This property cannot be used in a `style config - `__. - cornerRadius : float - The radius in pixels of rounded rectangle corners. +class OrderFieldDef(VegaLiteSchema): + """OrderFieldDef schema wrapper - **Default value:** ``0`` - cursor : :class:`Cursor` - The mouse cursor used over the mark. Any valid `CSS cursor type - `__ can be used. - dir : :class:`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. + Mapping(required=[type]) - **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. + Attributes + ---------- - **Default value:** ``"…"`` - fill : :class:`Color` - Default Fill Color. This has higher precedence than ``config.color`` + type : :class:`StandardType` + The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, + ``"ordinal"``, or ``"nominal"`` ). + It can also be a ``"geojson"`` type for encoding `'geoshape' + `__. - **Default value:** (None) - fillOpacity : float - The fill opacity (value between [0,1]). + **Note:** - **Default value:** ``1`` - filled : boolean - Whether the mark's color should be used as fill color instead of stroke color. - **Default value:** ``false`` for ``point``, ``line`` and ``rule`` ; otherwise, - ``true``. + * Data values for a temporal field can be either a date-time string (e.g., + ``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a + timestamp number (e.g., ``1552199579097`` ). + * Data ``type`` describes the semantics of the data rather than the primitive data + types ( ``number``, ``string``, etc.). The same primitive data type can have + different types of measurement. For example, numeric data can represent + quantitative, ordinal, or nominal data. + * When using with `bin `__, the + ``type`` property can be either ``"quantitative"`` (for using a linear bin scale) + or `"ordinal" (for using an ordinal bin scale) + `__. + * When using with `timeUnit + `__, the ``type`` property + can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using + an ordinal scale) `__. + * When using with `aggregate + `__, the ``type`` property + refers to the post-aggregation data type. For example, we can calculate count + ``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct", + "field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output + is ``"quantitative"``. + * Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have + ``type`` as they have exactly the same type as their primary channels (e.g., + ``x``, ``y`` ). - **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 : :class:`FontStyle` - The font style (e.g., ``"italic"`` ). - fontWeight : :class:`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`` - ). - height : float - Height of the marks. - href : string - A URL to load upon mouse click. If defined, the mark acts as a hyperlink. - interpolate : :class:`Interpolate` - The line interpolation method to use for line and area marks. One of the following: + **See also:** `type `__ + documentation. + aggregate : :class:`Aggregate` + Aggregation function for the field + (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). + **Default value:** ``undefined`` (None) - * ``"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. + **See also:** `aggregate `__ + documentation. + bin : anyOf(boolean, :class:`BinParams`, enum('binned'), None) + A flag for binning a ``quantitative`` field, `an object defining binning parameters + `__, or indicating that the + data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite ( + ``"binned"`` ). - **Default value:** ``0``, indicating no limit - opacity : float - The overall opacity (value between [0,1]). - **Default value:** ``0.7`` for non-aggregate plots with ``point``, ``tick``, - ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. - order : anyOf(None, boolean) - For line and trail marks, this ``order`` property can be set to ``null`` or - ``false`` to make the lines use the original order in the data sources. - orient : :class:`Orientation` - The orientation of a non-stacked bar, tick, area, and line charts. - The value is either horizontal (default) or vertical. + If ``true``, default `binning parameters + `__ will be applied. + If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are + already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end + field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to + binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also + set the axis's `tickMinStep + `__ property. - * 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`` and ``y`` properties. - shape : string - Shape of the point marks. Supported values include: + **Default value:** ``false`` + **See also:** `bin `__ + documentation. + field : :class:`Field` + **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. - * plotting shapes: ``"circle"``, ``"square"``, ``"cross"``, ``"diamond"``, - ``"triangle-up"``, ``"triangle-down"``, ``"triangle-right"``, or - ``"triangle-left"``. - * the line symbol ``"stroke"`` - * centered directional shapes ``"arrow"``, ``"wedge"``, or ``"triangle"`` - * a custom `SVG path string - `__ (For correct - sizing, custom shape paths should be defined within a square bounding box with - coordinates ranging from -1 to 1 along both the x and y dimensions.) + **See also:** `field `__ + documentation. - **Default value:** ``"circle"`` - size : float - Default size for marks. + **Notes:** + 1) 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 + `__. + 2) ``field`` is not required if ``aggregate`` is ``count``. + sort : :class:`SortOrder` + The sort order. One of ``"ascending"`` (default) or ``"descending"``. + timeUnit : :class:`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) - * For ``point`` / ``circle`` / ``square``, this represents the pixel area of the - marks. For example: in the case of circles, the radius is determined in part by - the square root of the size value. - * For ``bar``, this represents the band size of the bar, in pixels. - * For ``text``, this represents the font size, in pixels. + **See also:** `timeUnit `__ + documentation. + title : anyOf(string, None) + A title for the field. If ``null``, the title will be removed. - **Default value:** ``30`` for point, circle, square marks; ``rangeStep`` - 1 for bar - marks with discrete dimensions; ``5`` for bar marks with continuous dimensions; - ``11`` for text marks. - stroke : :class:`Color` - Default Stroke Color. This has higher precedence than ``config.color`` + **Default value:** derived from the field's name and transformation function ( + ``aggregate``, ``bin`` and ``timeUnit`` ). 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. - **Default value:** (None) - strokeCap : :class:`StrokeCap` - The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or - ``"square"``. + **Notes** : - **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 : :class:`StrokeJoin` - The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. + 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 + `__. - **Default value:** ``"miter"`` - strokeMiterLimit : float - The miter limit at which to bevel a line join. - strokeOpacity : float - The stroke opacity (value between [0,1]). + 2) If both field definition's ``title`` and axis, header, or legend ``title`` are + defined, axis/header/legend title will be used. + """ + _schema = {'$ref': '#/definitions/OrderFieldDef'} + _rootschema = Root._schema - **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`` and ``y`` properties. Values for ``theta`` follow the same convention of - ``arc`` mark ``startAngle`` and ``endAngle`` properties: angles are measured in - radians, with ``0`` indicating "north". - tooltip : anyOf(:class:`Value`, :class:`TooltipContent`, None) - The tooltip text string to show upon mouse hover or an object defining which fields - should the tooltip be derived from. + def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, + sort=Undefined, timeUnit=Undefined, title=Undefined, **kwds): + super(OrderFieldDef, self).__init__(type=type, aggregate=aggregate, bin=bin, field=field, + sort=sort, timeUnit=timeUnit, title=title, **kwds) - * If ``tooltip`` is ``{"content": "encoding"}``, then all fields from ``encoding`` - will be used. - * If ``tooltip`` is ``{"content": "data"}``, then all fields that appear in the - highlighted data point will be used. - * If set to ``null``, then no tooltip will be used. - width : float - Width of the marks. - x : anyOf(float, enum('width')) - X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without - specified ``x2`` or ``width``. +class Orient(VegaLiteSchema): + """Orient schema wrapper - The ``value`` of this channel can be a number or a string ``"width"`` for the width - of the plot. - x2 : anyOf(float, enum('width')) - X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + enum('left', 'right', 'top', 'bottom') + """ + _schema = {'$ref': '#/definitions/Orient'} + _rootschema = Root._schema - The ``value`` of this channel can be a number or a string ``"width"`` for the width - of the plot. - y : anyOf(float, enum('height')) - Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without - specified ``y2`` or ``height``. + def __init__(self, *args): + super(Orient, self).__init__(*args) - The ``value`` of this channel can be a number or a string ``"height"`` for the - height of the plot. - y2 : anyOf(float, enum('width')) - Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. - The ``value`` of this channel can be a number or a string ``"height"`` for the - height of the plot. +class Orientation(VegaLiteSchema): + """Orientation schema wrapper + + enum('horizontal', 'vertical') """ - _schema = {'$ref': '#/definitions/MarkConfig'} + _schema = {'$ref': '#/definitions/Orientation'} _rootschema = Root._schema - def __init__(self, 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, - height=Undefined, href=Undefined, interpolate=Undefined, limit=Undefined, - opacity=Undefined, order=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, width=Undefined, - x=Undefined, x2=Undefined, y=Undefined, y2=Undefined, **kwds): - super(MarkConfig, self).__init__(align=align, angle=angle, baseline=baseline, color=color, - cornerRadius=cornerRadius, cursor=cursor, dir=dir, dx=dx, - dy=dy, ellipsis=ellipsis, fill=fill, fillOpacity=fillOpacity, - filled=filled, font=font, fontSize=fontSize, - fontStyle=fontStyle, fontWeight=fontWeight, height=height, - href=href, interpolate=interpolate, limit=limit, - opacity=opacity, order=order, orient=orient, radius=radius, - shape=shape, size=size, stroke=stroke, strokeCap=strokeCap, - strokeDash=strokeDash, strokeDashOffset=strokeDashOffset, - strokeJoin=strokeJoin, strokeMiterLimit=strokeMiterLimit, - strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, - tension=tension, text=text, theta=theta, tooltip=tooltip, - width=width, x=x, x2=x2, y=y, y2=y2, **kwds) + def __init__(self, *args): + super(Orientation, self).__init__(*args) -class MarkDef(VegaLiteSchema): - """MarkDef schema wrapper +class OverlayMarkDef(VegaLiteSchema): + """OverlayMarkDef schema wrapper - Mapping(required=[type]) + Mapping(required=[]) Attributes ---------- - type : :class:`Mark` - The mark type. This could a primitive mark type - (one of ``"bar"``, ``"circle"``, ``"square"``, ``"tick"``, ``"line"``, - ``"area"``, ``"point"``, ``"geoshape"``, ``"rule"``, and ``"text"`` ) - or a composite mark type ( ``"boxplot"``, ``"errorband"``, ``"errorbar"`` ). align : :class:`Align` The horizontal alignment of the text. One of ``"left"``, ``"right"``, ``"center"``. angle : float @@ -9251,11 +8618,6 @@ class MarkDef(VegaLiteSchema): 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 : :class:`Color` @@ -9348,17 +8710,6 @@ class MarkDef(VegaLiteSchema): truncated if the rendered size exceeds the limit. **Default value:** ``0``, indicating no limit - line : anyOf(boolean, :class:`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 ( ``{}`` ) or ``true``, 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]). @@ -9374,27 +8725,12 @@ class MarkDef(VegaLiteSchema): * 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, :class:`OverlayMarkDef`, 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 ( ``{}`` ) or ``true``, 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``. + * 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`` and ``y`` properties. @@ -9475,10 +8811,6 @@ class MarkDef(VegaLiteSchema): the ``x`` and ``y`` properties. Values for ``theta`` follow the same convention of ``arc`` mark ``startAngle`` and ``endAngle`` properties: angles are measured in radians, with ``0`` indicating "north". - thickness : float - Thickness of the tick mark. - - **Default value:** ``1`` tooltip : anyOf(:class:`Value`, :class:`TooltipContent`, None) The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from. @@ -9522,269 +8854,148 @@ class MarkDef(VegaLiteSchema): yOffset : float Offset for y-position. """ - _schema = {'$ref': '#/definitions/MarkDef'} + _schema = {'$ref': '#/definitions/OverlayMarkDef'} _rootschema = Root._schema - def __init__(self, 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, height=Undefined, - href=Undefined, interpolate=Undefined, limit=Undefined, line=Undefined, - opacity=Undefined, order=Undefined, orient=Undefined, point=Undefined, + def __init__(self, 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, height=Undefined, href=Undefined, interpolate=Undefined, + limit=Undefined, opacity=Undefined, order=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, thickness=Undefined, tooltip=Undefined, width=Undefined, x=Undefined, - x2=Undefined, x2Offset=Undefined, xOffset=Undefined, y=Undefined, y2=Undefined, - y2Offset=Undefined, yOffset=Undefined, **kwds): - super(MarkDef, self).__init__(type=type, align=align, angle=angle, baseline=baseline, - binSpacing=binSpacing, clip=clip, color=color, - cornerRadius=cornerRadius, cursor=cursor, dir=dir, dx=dx, dy=dy, - ellipsis=ellipsis, fill=fill, fillOpacity=fillOpacity, - filled=filled, font=font, fontSize=fontSize, fontStyle=fontStyle, - fontWeight=fontWeight, height=height, href=href, - interpolate=interpolate, limit=limit, line=line, opacity=opacity, - order=order, orient=orient, point=point, radius=radius, - shape=shape, size=size, stroke=stroke, strokeCap=strokeCap, - strokeDash=strokeDash, strokeDashOffset=strokeDashOffset, - strokeJoin=strokeJoin, strokeMiterLimit=strokeMiterLimit, - strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, style=style, - tension=tension, text=text, theta=theta, thickness=thickness, - tooltip=tooltip, width=width, x=x, x2=x2, x2Offset=x2Offset, - xOffset=xOffset, y=y, y2=y2, y2Offset=y2Offset, yOffset=yOffset, - **kwds) + theta=Undefined, tooltip=Undefined, width=Undefined, x=Undefined, x2=Undefined, + x2Offset=Undefined, xOffset=Undefined, y=Undefined, y2=Undefined, y2Offset=Undefined, + yOffset=Undefined, **kwds): + super(OverlayMarkDef, self).__init__(align=align, angle=angle, baseline=baseline, clip=clip, + color=color, cornerRadius=cornerRadius, cursor=cursor, + dir=dir, dx=dx, dy=dy, ellipsis=ellipsis, fill=fill, + fillOpacity=fillOpacity, filled=filled, font=font, + fontSize=fontSize, fontStyle=fontStyle, + fontWeight=fontWeight, height=height, href=href, + interpolate=interpolate, limit=limit, opacity=opacity, + order=order, orient=orient, radius=radius, shape=shape, + size=size, stroke=stroke, strokeCap=strokeCap, + strokeDash=strokeDash, strokeDashOffset=strokeDashOffset, + strokeJoin=strokeJoin, strokeMiterLimit=strokeMiterLimit, + strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, + style=style, tension=tension, text=text, theta=theta, + tooltip=tooltip, width=width, x=x, x2=x2, + x2Offset=x2Offset, xOffset=xOffset, y=y, y2=y2, + y2Offset=y2Offset, yOffset=yOffset, **kwds) -class Month(VegaLiteSchema): - """Month schema wrapper +class Padding(VegaLiteSchema): + """Padding schema wrapper - float + anyOf(float, Mapping(required=[])) """ - _schema = {'$ref': '#/definitions/Month'} + _schema = {'$ref': '#/definitions/Padding'} _rootschema = Root._schema - def __init__(self, *args): - super(Month, self).__init__(*args) - - -class MultiSelection(VegaLiteSchema): - """MultiSelection schema wrapper - - Mapping(required=[type]) - - Attributes - ---------- - - type : enum('multi') - Determines the default event processing and data query for the selection. Vega-Lite - currently supports three selection types: - - - * ``single`` -- to select a single discrete data value on ``click``. - * ``multi`` -- to select multiple discrete data value; the first value is selected - on ``click`` and additional values toggled on shift- ``click``. - * ``interval`` -- to select a continuous range of data values on ``drag``. - clear : anyOf(:class:`EventStream`, boolean) - Clears the selection, emptying it of all values. Can be an - `EventStream `__ or ``false`` to - disable. - - **Default value:** ``dblclick``. - - **See also:** `clear `__ - documentation. - 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(:class:`SingleDefUnitChannel`) - An array of encoding channels. The corresponding data field values - must match for a data tuple to fall within the selection. + def __init__(self, *args, **kwds): + super(Padding, self).__init__(*args, **kwds) - **See also:** `encodings `__ - documentation. - fields : List(:class:`FieldName`) - An array of field names whose values must match for a data tuple to - fall within the selection. - **See also:** `fields `__ - documentation. - init : anyOf(:class:`SelectionInitMapping`, List(:class:`SelectionInitMapping`)) - Initialize the selection with a mapping between `projected channels or field names - `__ and an initial - value (or array of values). +class Parse(VegaLiteSchema): + """Parse schema wrapper - **See also:** `init `__ - documentation. - 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. + Mapping(required=[]) + """ + _schema = {'$ref': '#/definitions/Parse'} + _rootschema = Root._schema - **See also:** `nearest `__ - documentation. - on : :class:`EventStream` - A `Vega event stream `__ (object or - selector) that triggers the selection. - For interval selections, the event stream must specify a `start and end - `__. - resolve : :class:`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. + def __init__(self, **kwds): + super(Parse, self).__init__(**kwds) - **See also:** `resolve - `__ documentation. - 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 to ``event.shiftKey`` (i.e., - data values are toggled when a user interacts with the shift-key pressed). +class ParseValue(VegaLiteSchema): + """ParseValue schema wrapper - **See also:** `toggle `__ - documentation. + anyOf(None, string, enum('string'), enum('boolean'), enum('date'), enum('number')) """ - _schema = {'$ref': '#/definitions/MultiSelection'} + _schema = {'$ref': '#/definitions/ParseValue'} _rootschema = Root._schema - def __init__(self, type=Undefined, clear=Undefined, empty=Undefined, encodings=Undefined, - fields=Undefined, init=Undefined, nearest=Undefined, on=Undefined, resolve=Undefined, - toggle=Undefined, **kwds): - super(MultiSelection, self).__init__(type=type, clear=clear, empty=empty, encodings=encodings, - fields=fields, init=init, nearest=nearest, on=on, - resolve=resolve, toggle=toggle, **kwds) + def __init__(self, *args, **kwds): + super(ParseValue, self).__init__(*args, **kwds) -class MultiSelectionConfig(VegaLiteSchema): - """MultiSelectionConfig schema wrapper +class PartsMixinsBoxPlotPart(VegaLiteSchema): + """PartsMixinsBoxPlotPart schema wrapper Mapping(required=[]) Attributes ---------- - clear : anyOf(:class:`EventStream`, boolean) - Clears the selection, emptying it of all values. Can be an - `EventStream `__ or ``false`` to - disable. + box : anyOf(boolean, :class:`MarkConfig`) - **Default value:** ``dblclick``. + median : anyOf(boolean, :class:`MarkConfig`) - **See also:** `clear `__ - documentation. - 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(:class:`SingleDefUnitChannel`) - An array of encoding channels. The corresponding data field values - must match for a data tuple to fall within the selection. + outliers : anyOf(boolean, :class:`MarkConfig`) - **See also:** `encodings `__ - documentation. - fields : List(:class:`FieldName`) - An array of field names whose values must match for a data tuple to - fall within the selection. + rule : anyOf(boolean, :class:`MarkConfig`) - **See also:** `fields `__ - documentation. - init : anyOf(:class:`SelectionInitMapping`, List(:class:`SelectionInitMapping`)) - Initialize the selection with a mapping between `projected channels or field names - `__ and an initial - value (or array of values). + ticks : anyOf(boolean, :class:`MarkConfig`) - **See also:** `init `__ - documentation. - 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. + """ + _schema = {'$ref': '#/definitions/PartsMixins'} + _rootschema = Root._schema - **See also:** `nearest `__ - documentation. - on : :class:`EventStream` - A `Vega event stream `__ (object or - selector) that triggers the selection. - For interval selections, the event stream must specify a `start and end - `__. - resolve : :class:`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. + def __init__(self, box=Undefined, median=Undefined, outliers=Undefined, rule=Undefined, + ticks=Undefined, **kwds): + super(PartsMixinsBoxPlotPart, self).__init__(box=box, median=median, outliers=outliers, + rule=rule, ticks=ticks, **kwds) - **See also:** `resolve - `__ documentation. - 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 to ``event.shiftKey`` (i.e., - data values are toggled when a user interacts with the shift-key pressed). +class PartsMixinsErrorBandPart(VegaLiteSchema): + """PartsMixinsErrorBandPart schema wrapper - **See also:** `toggle `__ - documentation. - """ - _schema = {'$ref': '#/definitions/MultiSelectionConfig'} - _rootschema = Root._schema + Mapping(required=[]) - def __init__(self, clear=Undefined, empty=Undefined, encodings=Undefined, fields=Undefined, - init=Undefined, nearest=Undefined, on=Undefined, resolve=Undefined, toggle=Undefined, - **kwds): - super(MultiSelectionConfig, self).__init__(clear=clear, empty=empty, encodings=encodings, - fields=fields, init=init, nearest=nearest, on=on, - resolve=resolve, toggle=toggle, **kwds) + Attributes + ---------- + band : anyOf(boolean, :class:`MarkConfig`) -class MultiTimeUnit(VegaLiteSchema): - """MultiTimeUnit schema wrapper + borders : anyOf(boolean, :class:`MarkConfig`) - anyOf(:class:`LocalMultiTimeUnit`, :class:`UtcMultiTimeUnit`) """ - _schema = {'$ref': '#/definitions/MultiTimeUnit'} + _schema = {'$ref': '#/definitions/PartsMixins'} _rootschema = Root._schema - def __init__(self, *args, **kwds): - super(MultiTimeUnit, self).__init__(*args, **kwds) + def __init__(self, band=Undefined, borders=Undefined, **kwds): + super(PartsMixinsErrorBandPart, self).__init__(band=band, borders=borders, **kwds) -class NamedData(VegaLiteSchema): - """NamedData schema wrapper +class PartsMixinsErrorBarPart(VegaLiteSchema): + """PartsMixinsErrorBarPart schema wrapper - Mapping(required=[name]) + Mapping(required=[]) Attributes ---------- - name : string - Provide a placeholder name and bind data at runtime. - format : :class:`DataFormat` - An object that specifies the format for parsing the data. - """ - _schema = {'$ref': '#/definitions/NamedData'} - _rootschema = Root._schema - - def __init__(self, name=Undefined, format=Undefined, **kwds): - super(NamedData, self).__init__(name=name, format=format, **kwds) - + rule : anyOf(boolean, :class:`MarkConfig`) -class NiceTime(VegaLiteSchema): - """NiceTime schema wrapper + ticks : anyOf(boolean, :class:`MarkConfig`) - enum('second', 'minute', 'hour', 'day', 'week', 'month', 'year') """ - _schema = {'$ref': '#/definitions/NiceTime'} + _schema = {'$ref': '#/definitions/PartsMixins'} _rootschema = Root._schema - def __init__(self, *args): - super(NiceTime, self).__init__(*args) + def __init__(self, rule=Undefined, ticks=Undefined, **kwds): + super(PartsMixinsErrorBarPart, self).__init__(rule=rule, ticks=ticks, **kwds) -class NumericFieldDefWithCondition(VegaLiteSchema): - """NumericFieldDefWithCondition schema wrapper +class PositionFieldDef(VegaLiteSchema): + """PositionFieldDef schema wrapper Mapping(required=[type]) - A FieldDef with Condition :raw-html:`` Attributes ---------- @@ -9833,7 +9044,16 @@ class NumericFieldDefWithCondition(VegaLiteSchema): **See also:** `aggregate `__ documentation. - bin : anyOf(boolean, :class:`BinParams`, None) + axis : anyOf(:class:`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. + + **See also:** `axis `__ + documentation. + bin : anyOf(boolean, :class:`BinParams`, enum('binned'), None) A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite ( @@ -9854,14 +9074,6 @@ class NumericFieldDefWithCondition(VegaLiteSchema): **See also:** `bin `__ documentation. - condition : anyOf(:class:`ConditionalNumberValueDef`, - List(:class:`ConditionalNumberValueDef`)) - One or more value definition(s) with `a selection or a test predicate - `__. - - **Note:** A field definition's ``condition`` property can only contain `conditional - value definitions `__ - since Vega-Lite only allows at most one encoded field per encoding channel. field : :class:`Field` **Required.** A string defining the name of the field from which to pull a data value @@ -9879,286 +9091,560 @@ class NumericFieldDefWithCondition(VegaLiteSchema): See more details about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - legend : anyOf(:class:`Legend`, None) - An object defining properties of the legend. - If ``null``, the legend for the encoding channel will be removed. + impute : :class:`ImputeParams` + An object defining the properties of the Impute Operation to be applied. + The field value of the other positional channel is taken as ``key`` of the + ``Impute`` Operation. + The field of the ``color`` channel if specified is used as ``groupby`` of the + ``Impute`` Operation. + + **See also:** `impute `__ + documentation. + scale : anyOf(:class:`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. + + **See also:** `scale `__ + documentation. + sort : :class:`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-by-encoding definition + `__ for sorting + by another encoding channel. (This type of sort definition is not available for + ``row`` and ``column`` channels.) + * `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 for ``row`` and ``column``. + + **See also:** `sort `__ + documentation. + stack : anyOf(:class:`StackOffset`, None, boolean) + Type of stacking offset if the field should be stacked. + ``stack`` is only applicable for ``x`` and ``y`` channels with continuous domains. + For example, ``stack`` of ``y`` can be used to customize stacking for a vertical bar + chart. + + ``stack`` can be one of the following values: + + + * ``"zero"`` or `true`: 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 + `__. + :raw-html:`
` + - ``"center"`` - stacking with center baseline (for `streamgraph + `__ ). + * ``null`` or ``false`` - No-stacking. This will produce layered `bar + `__ and area + chart. + + **Default value:** ``zero`` for plots with all of the following conditions are true: + (1) the mark is ``bar`` or ``area`` ; + (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. + + **See also:** `stack `__ + documentation. + timeUnit : :class:`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) + + **See also:** `timeUnit `__ + documentation. + 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`` and ``timeUnit`` ). 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 legend ``title`` are + defined, axis/header/legend title will be used. + """ + _schema = {'$ref': '#/definitions/PositionFieldDef'} + _rootschema = Root._schema + + def __init__(self, type=Undefined, aggregate=Undefined, axis=Undefined, bin=Undefined, + field=Undefined, impute=Undefined, scale=Undefined, sort=Undefined, stack=Undefined, + timeUnit=Undefined, title=Undefined, **kwds): + super(PositionFieldDef, self).__init__(type=type, aggregate=aggregate, axis=axis, bin=bin, + field=field, impute=impute, scale=scale, sort=sort, + stack=stack, timeUnit=timeUnit, title=title, **kwds) + + +class Predicate(LogicalOperandPredicate): + """Predicate schema wrapper + + anyOf(:class:`FieldEqualPredicate`, :class:`FieldRangePredicate`, + :class:`FieldOneOfPredicate`, :class:`FieldLTPredicate`, :class:`FieldGTPredicate`, + :class:`FieldLTEPredicate`, :class:`FieldGTEPredicate`, :class:`FieldValidPredicate`, + :class:`SelectionPredicate`, string) + """ + _schema = {'$ref': '#/definitions/Predicate'} + _rootschema = Root._schema + + def __init__(self, *args, **kwds): + super(Predicate, self).__init__(*args, **kwds) + + +class FieldEqualPredicate(Predicate): + """FieldEqualPredicate schema wrapper + + Mapping(required=[equal, field]) + + Attributes + ---------- + + equal : anyOf(string, float, boolean, :class:`DateTime`) + The value that the field should be equal to. + field : :class:`FieldName` + Field to be filtered. + timeUnit : :class:`TimeUnit` + Time unit for the field to be filtered. + """ + _schema = {'$ref': '#/definitions/FieldEqualPredicate'} + _rootschema = Root._schema + + def __init__(self, equal=Undefined, field=Undefined, timeUnit=Undefined, **kwds): + super(FieldEqualPredicate, self).__init__(equal=equal, field=field, timeUnit=timeUnit, **kwds) + + +class FieldGTEPredicate(Predicate): + """FieldGTEPredicate schema wrapper + + Mapping(required=[field, gte]) + + Attributes + ---------- + + field : :class:`FieldName` + Field to be filtered. + gte : anyOf(string, float, :class:`DateTime`) + The value that the field should be greater than or equals to. + timeUnit : :class:`TimeUnit` + Time unit for the field to be filtered. + """ + _schema = {'$ref': '#/definitions/FieldGTEPredicate'} + _rootschema = Root._schema + + def __init__(self, field=Undefined, gte=Undefined, timeUnit=Undefined, **kwds): + super(FieldGTEPredicate, self).__init__(field=field, gte=gte, timeUnit=timeUnit, **kwds) + + +class FieldGTPredicate(Predicate): + """FieldGTPredicate schema wrapper + + Mapping(required=[field, gt]) + + Attributes + ---------- + + field : :class:`FieldName` + Field to be filtered. + gt : anyOf(string, float, :class:`DateTime`) + The value that the field should be greater than. + timeUnit : :class:`TimeUnit` + Time unit for the field to be filtered. + """ + _schema = {'$ref': '#/definitions/FieldGTPredicate'} + _rootschema = Root._schema + + def __init__(self, field=Undefined, gt=Undefined, timeUnit=Undefined, **kwds): + super(FieldGTPredicate, self).__init__(field=field, gt=gt, timeUnit=timeUnit, **kwds) - **Default value:** If undefined, default `legend properties - `__ are applied. - **See also:** `legend `__ - documentation. - scale : anyOf(:class:`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. +class FieldLTEPredicate(Predicate): + """FieldLTEPredicate schema wrapper - If ``null``, the scale will be `disabled and the data value will be directly encoded - `__. + Mapping(required=[field, lte]) - **Default value:** If undefined, default `scale properties - `__ are applied. + Attributes + ---------- - **See also:** `scale `__ - documentation. - sort : :class:`Sort` - Sort order for the encoded field. + field : :class:`FieldName` + Field to be filtered. + lte : anyOf(string, float, :class:`DateTime`) + The value that the field should be less than or equals to. + timeUnit : :class:`TimeUnit` + Time unit for the field to be filtered. + """ + _schema = {'$ref': '#/definitions/FieldLTEPredicate'} + _rootschema = Root._schema - For continuous fields (quantitative or temporal), ``sort`` can be either - ``"ascending"`` or ``"descending"``. + def __init__(self, field=Undefined, lte=Undefined, timeUnit=Undefined, **kwds): + super(FieldLTEPredicate, self).__init__(field=field, lte=lte, timeUnit=timeUnit, **kwds) - For discrete fields, ``sort`` can be one of the following: +class FieldLTPredicate(Predicate): + """FieldLTPredicate schema wrapper - * ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in - Javascript. - * `A sort-by-encoding definition - `__ for sorting - by another encoding channel. (This type of sort definition is not available for - ``row`` and ``column`` channels.) - * `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. + Mapping(required=[field, lt]) - **Default value:** ``"ascending"`` + Attributes + ---------- - **Note:** ``null`` is not supported for ``row`` and ``column``. + field : :class:`FieldName` + Field to be filtered. + lt : anyOf(string, float, :class:`DateTime`) + The value that the field should be less than. + timeUnit : :class:`TimeUnit` + Time unit for the field to be filtered. + """ + _schema = {'$ref': '#/definitions/FieldLTPredicate'} + _rootschema = Root._schema - **See also:** `sort `__ - documentation. + def __init__(self, field=Undefined, lt=Undefined, timeUnit=Undefined, **kwds): + super(FieldLTPredicate, self).__init__(field=field, lt=lt, timeUnit=timeUnit, **kwds) + + +class FieldOneOfPredicate(Predicate): + """FieldOneOfPredicate schema wrapper + + Mapping(required=[field, oneOf]) + + Attributes + ---------- + + field : :class:`FieldName` + Field to be filtered. + oneOf : anyOf(List(string), List(float), List(boolean), List(:class:`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 : :class:`TimeUnit` - Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal - field. - or `a temporal field that gets casted as ordinal - `__. + Time unit for the field to be filtered. + """ + _schema = {'$ref': '#/definitions/FieldOneOfPredicate'} + _rootschema = Root._schema - **Default value:** ``undefined`` (None) + def __init__(self, field=Undefined, oneOf=Undefined, timeUnit=Undefined, **kwds): + super(FieldOneOfPredicate, self).__init__(field=field, oneOf=oneOf, timeUnit=timeUnit, **kwds) - **See also:** `timeUnit `__ - documentation. - 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`` and ``timeUnit`` ). 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. +class FieldRangePredicate(Predicate): + """FieldRangePredicate schema wrapper - **Notes** : + Mapping(required=[field, range]) - 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 - `__. + Attributes + ---------- - 2) If both field definition's ``title`` and axis, header, or legend ``title`` are - defined, axis/header/legend title will be used. + field : :class:`FieldName` + Field to be filtered. + range : List(anyOf(float, :class:`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 : :class:`TimeUnit` + Time unit for the field to be filtered. """ - _schema = {'$ref': '#/definitions/NumericFieldDefWithCondition'} + _schema = {'$ref': '#/definitions/FieldRangePredicate'} _rootschema = Root._schema - def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, - field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, - title=Undefined, **kwds): - super(NumericFieldDefWithCondition, self).__init__(type=type, aggregate=aggregate, bin=bin, - condition=condition, field=field, - legend=legend, scale=scale, sort=sort, - timeUnit=timeUnit, title=title, **kwds) + def __init__(self, field=Undefined, range=Undefined, timeUnit=Undefined, **kwds): + super(FieldRangePredicate, self).__init__(field=field, range=range, timeUnit=timeUnit, **kwds) -class NumericValueDefWithCondition(VegaLiteSchema): - """NumericValueDefWithCondition schema wrapper +class FieldValidPredicate(Predicate): + """FieldValidPredicate schema wrapper - Mapping(required=[]) - A ValueDef with Condition where either the condition or the value are - optional. + Mapping(required=[field, valid]) Attributes ---------- - condition : anyOf(:class:`ConditionalMarkPropFieldDef`, :class:`ConditionalNumberValueDef`, - List(:class:`ConditionalNumberValueDef`)) - A field definition or one or more value definition(s) with a selection predicate. - value : float - A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values - between ``0`` to ``1`` for opacity). + field : :class:`FieldName` + Field to be filtered. + valid : boolean + If set to true the field's value has to be valid, meaning both not ``null`` and not + `NaN + `__. + timeUnit : :class:`TimeUnit` + Time unit for the field to be filtered. """ - _schema = {'$ref': '#/definitions/NumericValueDefWithCondition'} + _schema = {'$ref': '#/definitions/FieldValidPredicate'} _rootschema = Root._schema - def __init__(self, condition=Undefined, value=Undefined, **kwds): - super(NumericValueDefWithCondition, self).__init__(condition=condition, value=value, **kwds) + def __init__(self, field=Undefined, valid=Undefined, timeUnit=Undefined, **kwds): + super(FieldValidPredicate, self).__init__(field=field, valid=valid, timeUnit=timeUnit, **kwds) -class OrderFieldDef(VegaLiteSchema): - """OrderFieldDef schema wrapper +class Projection(VegaLiteSchema): + """Projection schema wrapper - Mapping(required=[type]) + Mapping(required=[]) Attributes ---------- - type : :class:`StandardType` - The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, - ``"ordinal"``, or ``"nominal"`` ). - It can also be a ``"geojson"`` type for encoding `'geoshape' - `__. + 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]]``, 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 : float + 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 + + reflectX : boolean + + reflectY : boolean + + 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]`` + scale : float + Sets the projection's scale (zoom) value, overriding automatic fitting. + spacing : float + + tilt : float + + translate : List(float) + Sets the projection's translation (pan) value, overriding automatic fitting. + type : :class:`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`` + """ + _schema = {'$ref': '#/definitions/Projection'} + _rootschema = Root._schema + + def __init__(self, center=Undefined, clipAngle=Undefined, clipExtent=Undefined, + coefficient=Undefined, distance=Undefined, fraction=Undefined, lobes=Undefined, + parallel=Undefined, precision=Undefined, radius=Undefined, ratio=Undefined, + reflectX=Undefined, reflectY=Undefined, rotate=Undefined, scale=Undefined, + spacing=Undefined, tilt=Undefined, translate=Undefined, type=Undefined, **kwds): + super(Projection, self).__init__(center=center, clipAngle=clipAngle, clipExtent=clipExtent, + coefficient=coefficient, distance=distance, fraction=fraction, + lobes=lobes, parallel=parallel, precision=precision, + radius=radius, ratio=ratio, reflectX=reflectX, + reflectY=reflectY, rotate=rotate, scale=scale, spacing=spacing, + tilt=tilt, translate=translate, type=type, **kwds) + + +class ProjectionConfig(VegaLiteSchema): + """ProjectionConfig schema wrapper + + Mapping(required=[]) - **Note:** + Attributes + ---------- + center : List(float) + Sets the projection’s center to the specified center, a two-element array of + longitude and latitude in degrees. - * Data values for a temporal field can be either a date-time string (e.g., - ``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a - timestamp number (e.g., ``1552199579097`` ). - * Data ``type`` describes the semantics of the data rather than the primitive data - types ( ``number``, ``string``, etc.). The same primitive data type can have - different types of measurement. For example, numeric data can represent - quantitative, ordinal, or nominal data. - * When using with `bin `__, the - ``type`` property can be either ``"quantitative"`` (for using a linear bin scale) - or `"ordinal" (for using an ordinal bin scale) - `__. - * When using with `timeUnit - `__, the ``type`` property - can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using - an ordinal scale) `__. - * When using with `aggregate - `__, the ``type`` property - refers to the post-aggregation data type. For example, we can calculate count - ``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct", - "field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output - is ``"quantitative"``. - * Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have - ``type`` as they have exactly the same type as their primary channels (e.g., - ``x``, ``y`` ). + **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]]``, 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 - **See also:** `type `__ - documentation. - aggregate : :class:`Aggregate` - Aggregation function for the field - (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). + distance : float - **Default value:** ``undefined`` (None) + fraction : float - **See also:** `aggregate `__ - documentation. - bin : anyOf(boolean, :class:`BinParams`, enum('binned'), None) - A flag for binning a ``quantitative`` field, `an object defining binning parameters - `__, or indicating that the - data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite ( - ``"binned"`` ). + lobes : float + parallel : float - If ``true``, default `binning parameters - `__ will be applied. + precision : float + 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 - If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are - already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end - field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to - binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also - set the axis's `tickMinStep - `__ property. + ratio : float - **Default value:** ``false`` + reflectX : boolean - **See also:** `bin `__ - documentation. - field : :class:`Field` - **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. + reflectY : boolean - **See also:** `field `__ - documentation. + 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.) - **Notes:** - 1) 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 - `__. - 2) ``field`` is not required if ``aggregate`` is ``count``. - sort : :class:`SortOrder` - The sort order. One of ``"ascending"`` (default) or ``"descending"``. - timeUnit : :class:`TimeUnit` - Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal - field. - or `a temporal field that gets casted as ordinal - `__. + **Default value:** ``[0, 0, 0]`` + scale : float + Sets the projection's scale (zoom) value, overriding automatic fitting. + spacing : float - **Default value:** ``undefined`` (None) + tilt : float - **See also:** `timeUnit `__ - documentation. - title : anyOf(string, None) - A title for the field. If ``null``, the title will be removed. + translate : List(float) + Sets the projection's translation (pan) value, overriding automatic fitting. + type : :class:`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:** derived from the field's name and transformation function ( - ``aggregate``, ``bin`` and ``timeUnit`` ). 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. + **Default value:** ``mercator`` + """ + _schema = {'$ref': '#/definitions/ProjectionConfig'} + _rootschema = Root._schema - **Notes** : + def __init__(self, center=Undefined, clipAngle=Undefined, clipExtent=Undefined, + coefficient=Undefined, distance=Undefined, fraction=Undefined, lobes=Undefined, + parallel=Undefined, precision=Undefined, radius=Undefined, ratio=Undefined, + reflectX=Undefined, reflectY=Undefined, rotate=Undefined, scale=Undefined, + spacing=Undefined, tilt=Undefined, translate=Undefined, type=Undefined, **kwds): + super(ProjectionConfig, self).__init__(center=center, clipAngle=clipAngle, + clipExtent=clipExtent, coefficient=coefficient, + distance=distance, fraction=fraction, lobes=lobes, + parallel=parallel, precision=precision, radius=radius, + ratio=ratio, reflectX=reflectX, reflectY=reflectY, + rotate=rotate, scale=scale, spacing=spacing, tilt=tilt, + translate=translate, type=type, **kwds) - 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 legend ``title`` are - defined, axis/header/legend title will be used. +class ProjectionType(VegaLiteSchema): + """ProjectionType schema wrapper + + enum('albers', 'albersUsa', 'azimuthalEqualArea', 'azimuthalEquidistant', 'conicConformal', + 'conicEqualArea', 'conicEquidistant', 'equirectangular', 'gnomonic', 'identity', 'mercator', + 'naturalEarth1', 'orthographic', 'stereographic', 'transverseMercator') """ - _schema = {'$ref': '#/definitions/OrderFieldDef'} + _schema = {'$ref': '#/definitions/ProjectionType'} _rootschema = Root._schema - def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined, - sort=Undefined, timeUnit=Undefined, title=Undefined, **kwds): - super(OrderFieldDef, self).__init__(type=type, aggregate=aggregate, bin=bin, field=field, - sort=sort, timeUnit=timeUnit, title=title, **kwds) + def __init__(self, *args): + super(ProjectionType, self).__init__(*args) -class Orient(VegaLiteSchema): - """Orient schema wrapper +class RangeConfig(VegaLiteSchema): + """RangeConfig schema wrapper - enum('left', 'right', 'top', 'bottom') + Mapping(required=[]) + + Attributes + ---------- + + category : anyOf(List(string), :class:`SchemeConfig`) + Default range for *nominal* (categorical) fields. + diverging : anyOf(List(string), :class:`SchemeConfig`) + Default range for diverging *quantitative* fields. + heatmap : anyOf(List(string), :class:`SchemeConfig`) + Default range for *quantitative* heatmaps. + ordinal : anyOf(List(string), :class:`SchemeConfig`) + Default range for *ordinal* fields. + ramp : anyOf(List(string), :class:`SchemeConfig`) + Default range for *quantitative* and *temporal* fields. + symbol : List(string) + Default range palette for the ``shape`` channel. """ - _schema = {'$ref': '#/definitions/Orient'} + _schema = {'$ref': '#/definitions/RangeConfig'} _rootschema = Root._schema - def __init__(self, *args): - super(Orient, self).__init__(*args) + def __init__(self, category=Undefined, diverging=Undefined, heatmap=Undefined, ordinal=Undefined, + ramp=Undefined, symbol=Undefined, **kwds): + super(RangeConfig, self).__init__(category=category, diverging=diverging, heatmap=heatmap, + ordinal=ordinal, ramp=ramp, symbol=symbol, **kwds) -class Orientation(VegaLiteSchema): - """Orientation schema wrapper +class RangeConfigValue(VegaLiteSchema): + """RangeConfigValue schema wrapper - enum('horizontal', 'vertical') + anyOf(List(anyOf(float, string)), :class:`SchemeConfig`, Mapping(required=[step])) """ - _schema = {'$ref': '#/definitions/Orientation'} + _schema = {'$ref': '#/definitions/RangeConfigValue'} _rootschema = Root._schema - def __init__(self, *args): - super(Orientation, self).__init__(*args) + def __init__(self, *args, **kwds): + super(RangeConfigValue, self).__init__(*args, **kwds) -class OverlayMarkDef(VegaLiteSchema): - """OverlayMarkDef schema wrapper +class RectConfig(VegaLiteSchema): + """RectConfig schema wrapper Mapping(required=[]) @@ -10173,8 +9659,11 @@ class OverlayMarkDef(VegaLiteSchema): 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. + 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 : :class:`Color` Default color. Note that ``fill`` and ``stroke`` have higher precedence than ``color`` and will override ``color``. @@ -10184,6 +9673,10 @@ class OverlayMarkDef(VegaLiteSchema): **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. @@ -10197,6 +9690,10 @@ class OverlayMarkDef(VegaLiteSchema): the limit parameter. **Default value:** ``"ltr"`` + discreteBandSize : float + The default size of the bars with discrete dimensions. 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. @@ -10342,20 +9839,6 @@ class OverlayMarkDef(VegaLiteSchema): **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 from ``config.style.bar`` and - ``config.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). @@ -10389,10 +9872,6 @@ class OverlayMarkDef(VegaLiteSchema): The ``value`` of this channel can be a number or a string ``"width"`` for the width of the plot. - x2Offset : float - Offset for x2-position. - xOffset : float - Offset for x-position. y : anyOf(float, enum('height')) Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without specified ``y2`` or ``height``. @@ -10404,16 +9883,13 @@ class OverlayMarkDef(VegaLiteSchema): The ``value`` of this channel can be a number or a string ``"height"`` for the height of the plot. - y2Offset : float - Offset for y2-position. - yOffset : float - Offset for y-position. """ - _schema = {'$ref': '#/definitions/OverlayMarkDef'} + _schema = {'$ref': '#/definitions/RectConfig'} _rootschema = Root._schema - - def __init__(self, align=Undefined, angle=Undefined, baseline=Undefined, clip=Undefined, - color=Undefined, cornerRadius=Undefined, cursor=Undefined, dir=Undefined, dx=Undefined, + + def __init__(self, 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, height=Undefined, href=Undefined, interpolate=Undefined, @@ -10421,2376 +9897,2523 @@ def __init__(self, align=Undefined, angle=Undefined, baseline=Undefined, clip=Un 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, width=Undefined, x=Undefined, x2=Undefined, - x2Offset=Undefined, xOffset=Undefined, y=Undefined, y2=Undefined, y2Offset=Undefined, - yOffset=Undefined, **kwds): - super(OverlayMarkDef, self).__init__(align=align, angle=angle, baseline=baseline, clip=clip, - color=color, cornerRadius=cornerRadius, cursor=cursor, - dir=dir, dx=dx, dy=dy, ellipsis=ellipsis, fill=fill, - fillOpacity=fillOpacity, filled=filled, font=font, - fontSize=fontSize, fontStyle=fontStyle, - fontWeight=fontWeight, height=height, href=href, - interpolate=interpolate, limit=limit, opacity=opacity, - order=order, orient=orient, radius=radius, shape=shape, - size=size, stroke=stroke, strokeCap=strokeCap, - strokeDash=strokeDash, strokeDashOffset=strokeDashOffset, - strokeJoin=strokeJoin, strokeMiterLimit=strokeMiterLimit, - strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, - style=style, tension=tension, text=text, theta=theta, - tooltip=tooltip, width=width, x=x, x2=x2, - x2Offset=x2Offset, xOffset=xOffset, y=y, y2=y2, - y2Offset=y2Offset, yOffset=yOffset, **kwds) + strokeWidth=Undefined, tension=Undefined, text=Undefined, theta=Undefined, + tooltip=Undefined, width=Undefined, x=Undefined, x2=Undefined, y=Undefined, + y2=Undefined, **kwds): + super(RectConfig, self).__init__(align=align, angle=angle, baseline=baseline, + binSpacing=binSpacing, color=color, + continuousBandSize=continuousBandSize, + cornerRadius=cornerRadius, cursor=cursor, dir=dir, + discreteBandSize=discreteBandSize, dx=dx, dy=dy, + ellipsis=ellipsis, fill=fill, fillOpacity=fillOpacity, + filled=filled, font=font, fontSize=fontSize, + fontStyle=fontStyle, fontWeight=fontWeight, height=height, + href=href, interpolate=interpolate, limit=limit, + opacity=opacity, order=order, orient=orient, radius=radius, + shape=shape, size=size, stroke=stroke, strokeCap=strokeCap, + strokeDash=strokeDash, strokeDashOffset=strokeDashOffset, + strokeJoin=strokeJoin, strokeMiterLimit=strokeMiterLimit, + strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, + tension=tension, text=text, theta=theta, tooltip=tooltip, + width=width, x=x, x2=x2, y=y, y2=y2, **kwds) -class Padding(VegaLiteSchema): - """Padding schema wrapper +class RepeatMapping(VegaLiteSchema): + """RepeatMapping schema wrapper - anyOf(float, Mapping(required=[])) + Mapping(required=[]) + + Attributes + ---------- + + column : List(string) + An array of fields to be repeated horizontally. + row : List(string) + An array of fields to be repeated vertically. """ - _schema = {'$ref': '#/definitions/Padding'} + _schema = {'$ref': '#/definitions/RepeatMapping'} _rootschema = Root._schema - def __init__(self, *args, **kwds): - super(Padding, self).__init__(*args, **kwds) - + def __init__(self, column=Undefined, row=Undefined, **kwds): + super(RepeatMapping, self).__init__(column=column, row=row, **kwds) -class Parse(VegaLiteSchema): - """Parse schema wrapper - Mapping(required=[]) - """ - _schema = {'$ref': '#/definitions/Parse'} - _rootschema = Root._schema +class RepeatRef(Field): + """RepeatRef schema wrapper - def __init__(self, **kwds): - super(Parse, self).__init__(**kwds) + Mapping(required=[repeat]) + A ValueDef with optional Condition + Reference to a repeated value. + Attributes + ---------- -class ParseValue(VegaLiteSchema): - """ParseValue schema wrapper + repeat : enum('row', 'column', 'repeat') - anyOf(None, string, enum('string'), enum('boolean'), enum('date'), enum('number')) """ - _schema = {'$ref': '#/definitions/ParseValue'} + _schema = {'$ref': '#/definitions/RepeatRef'} _rootschema = Root._schema - def __init__(self, *args, **kwds): - super(ParseValue, self).__init__(*args, **kwds) + def __init__(self, repeat=Undefined, **kwds): + super(RepeatRef, self).__init__(repeat=repeat, **kwds) -class PartsMixinsBoxPlotPart(VegaLiteSchema): - """PartsMixinsBoxPlotPart schema wrapper +class Resolve(VegaLiteSchema): + """Resolve schema wrapper Mapping(required=[]) + Defines how scales, axes, and legends from different specs should be combined. Resolve is a + mapping from ``scale``, ``axis``, and ``legend`` to a mapping from channels to resolutions. Attributes ---------- - box : anyOf(boolean, :class:`MarkConfig`) + axis : :class:`AxisResolveMap` - median : anyOf(boolean, :class:`MarkConfig`) + legend : :class:`LegendResolveMap` - outliers : anyOf(boolean, :class:`MarkConfig`) + scale : :class:`ScaleResolveMap` - rule : anyOf(boolean, :class:`MarkConfig`) + """ + _schema = {'$ref': '#/definitions/Resolve'} + _rootschema = Root._schema + + def __init__(self, axis=Undefined, legend=Undefined, scale=Undefined, **kwds): + super(Resolve, self).__init__(axis=axis, legend=legend, scale=scale, **kwds) - ticks : anyOf(boolean, :class:`MarkConfig`) +class ResolveMode(VegaLiteSchema): + """ResolveMode schema wrapper + + enum('independent', 'shared') """ - _schema = {'$ref': '#/definitions/PartsMixins'} + _schema = {'$ref': '#/definitions/ResolveMode'} _rootschema = Root._schema - def __init__(self, box=Undefined, median=Undefined, outliers=Undefined, rule=Undefined, - ticks=Undefined, **kwds): - super(PartsMixinsBoxPlotPart, self).__init__(box=box, median=median, outliers=outliers, - rule=rule, ticks=ticks, **kwds) + def __init__(self, *args): + super(ResolveMode, self).__init__(*args) -class PartsMixinsErrorBandPart(VegaLiteSchema): - """PartsMixinsErrorBandPart schema wrapper +class RowColLayoutAlign(VegaLiteSchema): + """RowColLayoutAlign schema wrapper Mapping(required=[]) Attributes ---------- - band : anyOf(boolean, :class:`MarkConfig`) + column : :class:`LayoutAlign` - borders : anyOf(boolean, :class:`MarkConfig`) + row : :class:`LayoutAlign` """ - _schema = {'$ref': '#/definitions/PartsMixins'} + _schema = {'$ref': '#/definitions/RowCol'} _rootschema = Root._schema - def __init__(self, band=Undefined, borders=Undefined, **kwds): - super(PartsMixinsErrorBandPart, self).__init__(band=band, borders=borders, **kwds) + def __init__(self, column=Undefined, row=Undefined, **kwds): + super(RowColLayoutAlign, self).__init__(column=column, row=row, **kwds) -class PartsMixinsErrorBarPart(VegaLiteSchema): - """PartsMixinsErrorBarPart schema wrapper +class RowColboolean(VegaLiteSchema): + """RowColboolean schema wrapper Mapping(required=[]) Attributes ---------- - rule : anyOf(boolean, :class:`MarkConfig`) + column : boolean - ticks : anyOf(boolean, :class:`MarkConfig`) + row : boolean """ - _schema = {'$ref': '#/definitions/PartsMixins'} + _schema = {'$ref': '#/definitions/RowCol'} _rootschema = Root._schema - def __init__(self, rule=Undefined, ticks=Undefined, **kwds): - super(PartsMixinsErrorBarPart, self).__init__(rule=rule, ticks=ticks, **kwds) + def __init__(self, column=Undefined, row=Undefined, **kwds): + super(RowColboolean, self).__init__(column=column, row=row, **kwds) -class PositionFieldDef(VegaLiteSchema): - """PositionFieldDef schema wrapper +class RowColnumber(VegaLiteSchema): + """RowColnumber schema wrapper - Mapping(required=[type]) + Mapping(required=[]) Attributes ---------- - type : :class:`StandardType` - The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, - ``"ordinal"``, or ``"nominal"`` ). - It can also be a ``"geojson"`` type for encoding `'geoshape' - `__. + column : float - **Note:** + row : float + """ + _schema = {'$ref': '#/definitions/RowCol'} + _rootschema = Root._schema - * Data values for a temporal field can be either a date-time string (e.g., - ``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a - timestamp number (e.g., ``1552199579097`` ). - * Data ``type`` describes the semantics of the data rather than the primitive data - types ( ``number``, ``string``, etc.). The same primitive data type can have - different types of measurement. For example, numeric data can represent - quantitative, ordinal, or nominal data. - * When using with `bin `__, the - ``type`` property can be either ``"quantitative"`` (for using a linear bin scale) - or `"ordinal" (for using an ordinal bin scale) - `__. - * When using with `timeUnit - `__, the ``type`` property - can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using - an ordinal scale) `__. - * When using with `aggregate - `__, the ``type`` property - refers to the post-aggregation data type. For example, we can calculate count - ``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct", - "field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output - is ``"quantitative"``. - * Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have - ``type`` as they have exactly the same type as their primary channels (e.g., - ``x``, ``y`` ). + def __init__(self, column=Undefined, row=Undefined, **kwds): + super(RowColnumber, self).__init__(column=column, row=row, **kwds) - **See also:** `type `__ - documentation. - aggregate : :class:`Aggregate` - Aggregation function for the field - (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). - **Default value:** ``undefined`` (None) +class Scale(VegaLiteSchema): + """Scale schema wrapper - **See also:** `aggregate `__ - documentation. - axis : anyOf(:class:`Axis`, None) - An object defining properties of axis's gridlines, ticks and labels. - If ``null``, the axis for the encoding channel will be removed. + Mapping(required=[]) - **Default value:** If undefined, default `axis properties - `__ are applied. + Attributes + ---------- - **See also:** `axis `__ - documentation. - bin : anyOf(boolean, :class:`BinParams`, enum('binned'), None) - A flag for binning a ``quantitative`` field, `an object defining binning parameters - `__, or indicating that the - data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite ( - ``"binned"`` ). + align : float + The alignment of the steps within the scale range. + This value must lie in the range ``[0,1]``. A value of ``0.5`` indicates that the + steps should be centered within the range. A value of ``0`` or ``1`` may be used to + shift the bands to one side, say to position them adjacent to an axis. - If ``true``, default `binning parameters - `__ will be applied. + **Default value:** ``0.5`` + base : float + The logarithm base of the ``log`` scale (default ``10`` ). + bins : List(float) + An array of bin boundaries over the scale domain. If provided, axes and legends will + use the bin boundaries to inform the choice of tick marks and text labels. + clamp : boolean + If ``true``, values that exceed the data domain are clamped to either the minimum or + maximum range value + + **Default value:** derived from the `scale config + `__ 's ``clamp`` ( + ``true`` by default). + constant : float + A constant determining the slope of the symlog function around zero. Only used for + ``symlog`` scales. + + **Default value:** ``1`` + domain : anyOf(List(float), List(string), List(boolean), List(:class:`DateTime`), + enum('unaggregated'), :class:`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 a ``domain`` 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 + `__. - If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are - already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end - field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to - binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also - set the axis's `tickMinStep - `__ property. + For *ordinal* and *nominal* fields, ``domain`` can be an array that lists valid + input values. - **Default value:** ``false`` + The ``selection`` property can be used to `interactively determine + `__ the scale + domain. + exponent : float + The exponent of the ``pow`` scale. + interpolate : anyOf(:class:`ScaleInterpolate`, :class:`ScaleInterpolateParams`) + The interpolation method for range values. By default, a general interpolator for + numbers, dates, strings and colors (in HCL 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`` and + ``cubehelix-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 + `__. - **See also:** `bin `__ - documentation. - field : :class:`Field` - **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. - **See also:** `field `__ - documentation. + * **Default value:** ``hcl`` + nice : anyOf(boolean, float, :class:`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]*. - **Notes:** - 1) 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 - `__. - 2) ``field`` is not required if ``aggregate`` is ``count``. - impute : :class:`ImputeParams` - An object defining the properties of the Impute Operation to be applied. - The field value of the other positional channel is taken as ``key`` of the - ``Impute`` Operation. - The field of the ``color`` channel if specified is used as ``groupby`` of the - ``Impute`` Operation. + For quantitative scales such as linear, ``nice`` can be either a boolean flag or a + number. If ``nice`` 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. - **See also:** `impute `__ - documentation. - scale : anyOf(:class:`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. + 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`` and ``utc`` 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. - If ``null``, the scale will be `disabled and the data value will be directly encoded - `__. + **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. - **Default value:** If undefined, default `scale properties - `__ are applied. + For * `band `__ * scales, + shortcut for setting ``paddingInner`` and ``paddingOuter`` to the same value. - **See also:** `scale `__ - documentation. - sort : :class:`Sort` - Sort order for the encoded field. + For * `point `__ * scales, + alias for ``paddingOuter``. - For continuous fields (quantitative or temporal), ``sort`` can be either - ``"ascending"`` or ``"descending"``. + **Default value:** For *continuous* scales, derived from the `scale config + `__ 's + ``continuousPadding``. + For *band and point* scales, see ``paddingInner`` and ``paddingOuter``. By default, + Vega-Lite sets padding such that *width/height = number of unique values * step*. + 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 discrete fields, ``sort`` can be one of the following: + 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]. - * ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in - Javascript. - * `A sort-by-encoding definition - `__ for sorting - by another encoding channel. (This type of sort definition is not available for - ``row`` and ``column`` channels.) - * `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:** derived from the `scale config + `__ 's ``bandPaddingOuter`` + for band scales and ``pointPadding`` for point scales. + By default, Vega-Lite sets outer padding such that *width/height = number of unique + values * step*. + range : anyOf(List(float), List(string), string) + The range of the scale. One of: - **Default value:** ``"ascending"`` - **Note:** ``null`` is not supported for ``row`` and ``column``. + A string indicating a `pre-defined named scale range + `__ (e.g., example, + ``"symbol"``, or ``"diverging"`` ). - **See also:** `sort `__ - documentation. - stack : anyOf(:class:`StackOffset`, None, boolean) - Type of stacking offset if the field should be stacked. - ``stack`` is only applicable for ``x`` and ``y`` channels with continuous domains. - For example, ``stack`` of ``y`` can be used to customize stacking for a vertical bar - chart. + For `continuous scales + `__, two-element array + indicating minimum and maximum values, or an array with more than two entries for + specifying a `piecewise scale + `__. - ``stack`` can be one of the following values: + For `discrete `__ and + `discretizing `__ + scales, an array of desired output values. + **Notes:** - * ``"zero"`` or `true`: 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 - `__. - :raw-html:`
` - - ``"center"`` - stacking with center baseline (for `streamgraph - `__ ). - * ``null`` or ``false`` - No-stacking. This will produce layered `bar - `__ and area - chart. + 1) For color scales you can also specify a color `scheme + `__ instead of ``range``. - **Default value:** ``zero`` for plots with all of the following conditions are true: - (1) the mark is ``bar`` or ``area`` ; - (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. + 2) Any directly specified ``range`` for ``x`` and ``y`` channels will be ignored. + Range can be customized via the view's corresponding `size + `__ ( ``width`` and ``height`` ) or + via `range steps and paddings properties <#range-step>`__ for `band <#band>`__ and + `point <#point>`__ scales. + rangeStep : anyOf(float, None) + The distance between the starts of adjacent bands or points in `band + `__ and `point + `__ scales. - **See also:** `stack `__ - documentation. - timeUnit : :class:`TimeUnit` - Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal - field. - or `a temporal field that gets casted as ordinal - `__. + If ``rangeStep`` is ``null`` or if the view contains the scale's corresponding `size + `__ ( ``width`` for ``x`` scales + and ``height`` for ``y`` scales), ``rangeStep`` will be automatically determined to + fit the size of the view. - **Default value:** ``undefined`` (None) + **Default value:** derived the `scale config + `__ 's + ``textXRangeStep`` ( ``90`` by default) for x-scales of ``text`` marks and + ``rangeStep`` ( ``21`` by default) for x-scales of other marks and y-scales. - **See also:** `timeUnit `__ - documentation. - title : anyOf(string, None) - A title for the field. If ``null``, the title will be removed. + **Warning** : If ``rangeStep`` is ``null`` and the cardinality of the scale's domain + is higher than ``width`` or ``height``, 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:** derived from the field's name and transformation function ( - ``aggregate``, ``bin`` and ``timeUnit`` ). 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. + **Default value:** ``false``. + scheme : anyOf(string, :class:`SchemeParams`) + A string indicating a color `scheme + `__ name (e.g., + ``"category10"`` or ``"blues"`` ) or a `scheme parameter object + `__. - **Notes** : + Discrete color schemes may be used with `discrete + `__ or `discretizing + `__ scales. + Continuous color schemes are intended for use with color scales. - 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 - `__. + For the full list of supported schemes, please refer to the `Vega Scheme + `__ reference. + type : :class:`ScaleType` + The type of scale. Vega-Lite supports the following categories of scale types: - 2) If both field definition's ``title`` and axis, header, or legend ``title`` are - defined, axis/header/legend title will be used. - """ - _schema = {'$ref': '#/definitions/PositionFieldDef'} - _rootschema = Root._schema + 1) `Continuous Scales + `__ -- mapping + continuous domains to continuous output ranges ( `"linear" + `__, `"pow" + `__, `"sqrt" + `__, `"symlog" + `__, `"log" + `__, `"time" + `__, `"utc" + `__. + + 2) `Discrete Scales `__ + -- mapping discrete domains to discrete ( `"ordinal" + `__ ) or continuous ( + `"band" `__ and `"point" + `__ ) output ranges. - def __init__(self, type=Undefined, aggregate=Undefined, axis=Undefined, bin=Undefined, - field=Undefined, impute=Undefined, scale=Undefined, sort=Undefined, stack=Undefined, - timeUnit=Undefined, title=Undefined, **kwds): - super(PositionFieldDef, self).__init__(type=type, aggregate=aggregate, axis=axis, bin=bin, - field=field, impute=impute, scale=scale, sort=sort, - stack=stack, timeUnit=timeUnit, title=title, **kwds) + 3) `Discretizing Scales + `__ -- mapping + continuous domains to discrete output ranges `"bin-ordinal" + `__, `"quantile" + `__, `"quantize" + `__ and `"threshold" + `__. + **Default value:** please see the `scale type table + `__. + zero : boolean + If ``true``, ensures that a zero baseline value is included in the scale domain. -class Predicate(VegaLiteSchema): - """Predicate schema wrapper + **Default value:** ``true`` for x and y channels if the quantitative field is not + binned and no custom ``domain`` is provided; ``false`` otherwise. - anyOf(:class:`FieldEqualPredicate`, :class:`FieldRangePredicate`, - :class:`FieldOneOfPredicate`, :class:`FieldLTPredicate`, :class:`FieldGTPredicate`, - :class:`FieldLTEPredicate`, :class:`FieldGTEPredicate`, :class:`FieldValidPredicate`, - :class:`SelectionPredicate`, string) + **Note:** Log, time, and utc scales do not support ``zero``. """ - _schema = {'$ref': '#/definitions/Predicate'} + _schema = {'$ref': '#/definitions/Scale'} _rootschema = Root._schema - def __init__(self, *args, **kwds): - super(Predicate, self).__init__(*args, **kwds) + def __init__(self, align=Undefined, base=Undefined, bins=Undefined, clamp=Undefined, + constant=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): + super(Scale, self).__init__(align=align, base=base, bins=bins, clamp=clamp, constant=constant, + domain=domain, exponent=exponent, interpolate=interpolate, + nice=nice, padding=padding, paddingInner=paddingInner, + paddingOuter=paddingOuter, range=range, rangeStep=rangeStep, + round=round, scheme=scheme, type=type, zero=zero, **kwds) -class Projection(VegaLiteSchema): - """Projection schema wrapper +class ScaleConfig(VegaLiteSchema): + """ScaleConfig 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]]``, 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 : float - 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 - - reflectX : boolean - - reflectY : boolean - - 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]`` - scale : float - Sets the projection's scale (zoom) value, overriding automatic fitting. - spacing : float + bandPaddingInner : float + Default inner padding for ``x`` and ``y`` band-ordinal scales. - tilt : float + **Default value:** - translate : List(float) - Sets the projection's translation (pan) value, overriding automatic fitting. - type : :class:`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`` - """ - _schema = {'$ref': '#/definitions/Projection'} - _rootschema = Root._schema + * ``barBandPaddingInner`` for bar marks ( ``0.1`` by default) + * ``rectBandPaddingInner`` for rect and other marks ( ``0`` by default) + bandPaddingOuter : float + Default outer padding for ``x`` and ``y`` band-ordinal scales. - def __init__(self, center=Undefined, clipAngle=Undefined, clipExtent=Undefined, - coefficient=Undefined, distance=Undefined, fraction=Undefined, lobes=Undefined, - parallel=Undefined, precision=Undefined, radius=Undefined, ratio=Undefined, - reflectX=Undefined, reflectY=Undefined, rotate=Undefined, scale=Undefined, - spacing=Undefined, tilt=Undefined, translate=Undefined, type=Undefined, **kwds): - super(Projection, self).__init__(center=center, clipAngle=clipAngle, clipExtent=clipExtent, - coefficient=coefficient, distance=distance, fraction=fraction, - lobes=lobes, parallel=parallel, precision=precision, - radius=radius, ratio=ratio, reflectX=reflectX, - reflectY=reflectY, rotate=rotate, scale=scale, spacing=spacing, - tilt=tilt, translate=translate, type=type, **kwds) + **Default value:** ``paddingInner/2`` (which makes *width/height = number of unique + values * step* ) + barBandPaddingInner : float + Default inner padding for ``x`` and ``y`` band-ordinal scales of ``"bar"`` marks. + **Default value:** ``0.1`` + barBandPaddingOuter : float + Default outer padding for ``x`` and ``y`` band-ordinal scales of ``"bar"`` marks. + 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. -class ProjectionConfig(VegaLiteSchema): - """ProjectionConfig schema wrapper + **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. - Mapping(required=[]) + 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. - Attributes - ---------- + **Default value:** ``40`` + maxOpacity : float + Default max opacity for mapping a field to opacity. - 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.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:** ``[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]]``, 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 + **Default value:** ``4`` + minBandSize : float + The default min value for mapping quantitative fields to bar and tick's + size/bandSize scale with zero=false. - distance : float + **Default value:** ``2`` + minFontSize : float + The default min value for mapping quantitative fields to tick's size/fontSize scale + with zero=false - fraction : float + **Default value:** ``8`` + minOpacity : float + Default minimum opacity for mapping a field to opacity. - lobes : float + **Default value:** ``0.3`` + minSize : float + Default minimum value for point size scale with zero=false. - parallel : float + **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. - precision : float - 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 + **Default value:** ``1`` + pointPadding : float + Default outer padding for ``x`` and ``y`` point-ordinal scales. - ratio : float + **Default value:** ``0.5`` (which makes *width/height = number of unique values * + step* ) + quantileCount : float + Default range cardinality for `quantile + `__ scale. - reflectX : boolean + **Default value:** ``4`` + quantizeCount : float + Default range cardinality for `quantize + `__ scale. - reflectY : boolean + **Default value:** ``4`` + rangeStep : anyOf(float, None) + Default range step for band and point scales of (1) the ``y`` channel + and (2) the ``x`` channel when the mark is not ``text``. - 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:** ``20`` + rectBandPaddingInner : float + Default inner padding for ``x`` and ``y`` band-ordinal scales of ``"rect"`` marks. - **Default value:** ``[0, 0, 0]`` - scale : float - Sets the projection's scale (zoom) value, overriding automatic fitting. - spacing : float + **Default value:** ``0`` + rectBandPaddingOuter : float + Default outer padding for ``x`` and ``y`` band-ordinal scales of ``"rect"`` marks. + If not specified, by default, band scale's paddingOuter is paddingInner/2. + 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``, and ``size`` scales.) + textXRangeStep : float + Default range step for ``x`` band and point scales of text marks. - tilt : float + **Default value:** ``90`` + useUnaggregatedDomain : boolean + Use the source data range before aggregation as scale domain instead of aggregated + data for aggregate axis. - translate : List(float) - Sets the projection's translation (pan) value, overriding automatic fitting. - type : :class:`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 - `__. + This is equivalent to setting ``domain`` to ``"unaggregate"`` for aggregated + *quantitative* fields by default. - **Default value:** ``mercator`` + 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`` """ - _schema = {'$ref': '#/definitions/ProjectionConfig'} + _schema = {'$ref': '#/definitions/ScaleConfig'} _rootschema = Root._schema - def __init__(self, center=Undefined, clipAngle=Undefined, clipExtent=Undefined, - coefficient=Undefined, distance=Undefined, fraction=Undefined, lobes=Undefined, - parallel=Undefined, precision=Undefined, radius=Undefined, ratio=Undefined, - reflectX=Undefined, reflectY=Undefined, rotate=Undefined, scale=Undefined, - spacing=Undefined, tilt=Undefined, translate=Undefined, type=Undefined, **kwds): - super(ProjectionConfig, self).__init__(center=center, clipAngle=clipAngle, - clipExtent=clipExtent, coefficient=coefficient, - distance=distance, fraction=fraction, lobes=lobes, - parallel=parallel, precision=precision, radius=radius, - ratio=ratio, reflectX=reflectX, reflectY=reflectY, - rotate=rotate, scale=scale, spacing=spacing, tilt=tilt, - translate=translate, type=type, **kwds) + def __init__(self, bandPaddingInner=Undefined, bandPaddingOuter=Undefined, + barBandPaddingInner=Undefined, barBandPaddingOuter=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, quantileCount=Undefined, + quantizeCount=Undefined, rangeStep=Undefined, rectBandPaddingInner=Undefined, + rectBandPaddingOuter=Undefined, round=Undefined, textXRangeStep=Undefined, + useUnaggregatedDomain=Undefined, **kwds): + super(ScaleConfig, self).__init__(bandPaddingInner=bandPaddingInner, + bandPaddingOuter=bandPaddingOuter, + barBandPaddingInner=barBandPaddingInner, + barBandPaddingOuter=barBandPaddingOuter, clamp=clamp, + continuousPadding=continuousPadding, maxBandSize=maxBandSize, + maxFontSize=maxFontSize, maxOpacity=maxOpacity, + maxSize=maxSize, maxStrokeWidth=maxStrokeWidth, + minBandSize=minBandSize, minFontSize=minFontSize, + minOpacity=minOpacity, minSize=minSize, + minStrokeWidth=minStrokeWidth, pointPadding=pointPadding, + quantileCount=quantileCount, quantizeCount=quantizeCount, + rangeStep=rangeStep, + rectBandPaddingInner=rectBandPaddingInner, + rectBandPaddingOuter=rectBandPaddingOuter, round=round, + textXRangeStep=textXRangeStep, + useUnaggregatedDomain=useUnaggregatedDomain, **kwds) -class ProjectionType(VegaLiteSchema): - """ProjectionType schema wrapper +class ScaleInterpolate(VegaLiteSchema): + """ScaleInterpolate schema wrapper - enum('albers', 'albersUsa', 'azimuthalEqualArea', 'azimuthalEquidistant', 'conicConformal', - 'conicEqualArea', 'conicEquidistant', 'equirectangular', 'gnomonic', 'identity', 'mercator', - 'naturalEarth1', 'orthographic', 'stereographic', 'transverseMercator') + enum('rgb', 'lab', 'hcl', 'hsl', 'hsl-long', 'hcl-long', 'cubehelix', 'cubehelix-long') """ - _schema = {'$ref': '#/definitions/ProjectionType'} + _schema = {'$ref': '#/definitions/ScaleInterpolate'} _rootschema = Root._schema def __init__(self, *args): - super(ProjectionType, self).__init__(*args) + super(ScaleInterpolate, self).__init__(*args) -class RangeConfig(VegaLiteSchema): - """RangeConfig schema wrapper +class ScaleInterpolateParams(VegaLiteSchema): + """ScaleInterpolateParams schema wrapper - Mapping(required=[]) + Mapping(required=[type]) Attributes ---------- - category : anyOf(List(string), :class:`SchemeConfig`) - Default range for *nominal* (categorical) fields. - diverging : anyOf(List(string), :class:`SchemeConfig`) - Default range for diverging *quantitative* fields. - heatmap : anyOf(List(string), :class:`SchemeConfig`) - Default range for *quantitative* heatmaps. - ordinal : anyOf(List(string), :class:`SchemeConfig`) - Default range for *ordinal* fields. - ramp : anyOf(List(string), :class:`SchemeConfig`) - Default range for *quantitative* and *temporal* fields. - symbol : List(string) - Default range palette for the ``shape`` channel. - """ - _schema = {'$ref': '#/definitions/RangeConfig'} - _rootschema = Root._schema - - def __init__(self, category=Undefined, diverging=Undefined, heatmap=Undefined, ordinal=Undefined, - ramp=Undefined, symbol=Undefined, **kwds): - super(RangeConfig, self).__init__(category=category, diverging=diverging, heatmap=heatmap, - ordinal=ordinal, ramp=ramp, symbol=symbol, **kwds) - + type : enum('rgb', 'cubehelix', 'cubehelix-long') -class RangeConfigValue(VegaLiteSchema): - """RangeConfigValue schema wrapper + gamma : float - anyOf(List(anyOf(float, string)), :class:`SchemeConfig`, Mapping(required=[step])) """ - _schema = {'$ref': '#/definitions/RangeConfigValue'} + _schema = {'$ref': '#/definitions/ScaleInterpolateParams'} _rootschema = Root._schema - def __init__(self, *args, **kwds): - super(RangeConfigValue, self).__init__(*args, **kwds) + def __init__(self, type=Undefined, gamma=Undefined, **kwds): + super(ScaleInterpolateParams, self).__init__(type=type, gamma=gamma, **kwds) -class RectConfig(VegaLiteSchema): - """RectConfig schema wrapper +class ScaleResolveMap(VegaLiteSchema): + """ScaleResolveMap schema wrapper Mapping(required=[]) Attributes ---------- - align : :class:`Align` - The horizontal alignment of the text. One of ``"left"``, ``"right"``, ``"center"``. - angle : float - The rotation angle of the text, in degrees. - baseline : :class:`TextBaseline` - 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 : :class:`Color` - Default color. Note that ``fill`` and ``stroke`` have higher precedence than - ``color`` and will override ``color``. - - **Default value:** :raw-html:`` - ``"#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 : :class:`Cursor` - The mouse cursor used over the mark. Any valid `CSS cursor type - `__ can be used. - dir : :class:`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 default size of the bars with discrete dimensions. 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 : :class:`Color` - 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. + color : :class:`ResolveMode` - **Default value:** ``false`` for ``point``, ``line`` and ``rule`` ; otherwise, - ``true``. + fill : :class:`ResolveMode` - **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 : :class:`FontStyle` - The font style (e.g., ``"italic"`` ). - fontWeight : :class:`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`` - ). - height : float - Height of the marks. - href : string - A URL to load upon mouse click. If defined, the mark acts as a hyperlink. - interpolate : :class:`Interpolate` - The line interpolation method to use for line and area marks. One of the following: + fillOpacity : :class:`ResolveMode` + opacity : :class:`ResolveMode` - * ``"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. + shape : :class:`ResolveMode` - **Default value:** ``0``, indicating no limit - opacity : float - The overall opacity (value between [0,1]). + size : :class:`ResolveMode` - **Default value:** ``0.7`` for non-aggregate plots with ``point``, ``tick``, - ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. - order : anyOf(None, boolean) - For line and trail marks, this ``order`` property can be set to ``null`` or - ``false`` to make the lines use the original order in the data sources. - orient : :class:`Orientation` - The orientation of a non-stacked bar, tick, area, and line charts. - The value is either horizontal (default) or vertical. + stroke : :class:`ResolveMode` + strokeOpacity : :class:`ResolveMode` - * 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`` and ``y`` properties. - shape : string - Shape of the point marks. Supported values include: + strokeWidth : :class:`ResolveMode` + x : :class:`ResolveMode` - * plotting shapes: ``"circle"``, ``"square"``, ``"cross"``, ``"diamond"``, - ``"triangle-up"``, ``"triangle-down"``, ``"triangle-right"``, or - ``"triangle-left"``. - * the line symbol ``"stroke"`` - * centered directional shapes ``"arrow"``, ``"wedge"``, or ``"triangle"`` - * a custom `SVG path string - `__ (For correct - sizing, custom shape paths should be defined within a square bounding box with - coordinates ranging from -1 to 1 along both the x and y dimensions.) + y : :class:`ResolveMode` - **Default value:** ``"circle"`` - size : float - Default size for marks. + """ + _schema = {'$ref': '#/definitions/ScaleResolveMap'} + _rootschema = Root._schema + def __init__(self, color=Undefined, fill=Undefined, fillOpacity=Undefined, opacity=Undefined, + shape=Undefined, size=Undefined, stroke=Undefined, strokeOpacity=Undefined, + strokeWidth=Undefined, x=Undefined, y=Undefined, **kwds): + super(ScaleResolveMap, self).__init__(color=color, fill=fill, fillOpacity=fillOpacity, + opacity=opacity, shape=shape, size=size, stroke=stroke, + strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, x=x, + y=y, **kwds) - * For ``point`` / ``circle`` / ``square``, this represents the pixel area of the - marks. For example: in the case of circles, the radius is determined in part by - the square root of the size value. - * For ``bar``, this represents the band size of the bar, in pixels. - * For ``text``, this represents the font size, in pixels. - **Default value:** ``30`` for point, circle, square marks; ``rangeStep`` - 1 for bar - marks with discrete dimensions; ``5`` for bar marks with continuous dimensions; - ``11`` for text marks. - stroke : :class:`Color` - Default Stroke Color. This has higher precedence than ``config.color`` +class ScaleType(VegaLiteSchema): + """ScaleType schema wrapper - **Default value:** (None) - strokeCap : :class:`StrokeCap` - The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or - ``"square"``. + enum('linear', 'log', 'pow', 'sqrt', 'symlog', 'time', 'utc', 'quantile', 'quantize', + 'threshold', 'bin-ordinal', 'ordinal', 'point', 'band') + """ + _schema = {'$ref': '#/definitions/ScaleType'} + _rootschema = Root._schema - **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 : :class:`StrokeJoin` - The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. + def __init__(self, *args): + super(ScaleType, self).__init__(*args) - **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`` and ``y`` properties. Values for ``theta`` follow the same convention of - ``arc`` mark ``startAngle`` and ``endAngle`` properties: angles are measured in - radians, with ``0`` indicating "north". - tooltip : anyOf(:class:`Value`, :class:`TooltipContent`, None) - The tooltip text string to show upon mouse hover or an object defining which fields - should the tooltip be derived from. +class SchemeConfig(RangeConfigValue): + """SchemeConfig schema wrapper + Mapping(required=[scheme]) - * If ``tooltip`` is ``{"content": "encoding"}``, then all fields from ``encoding`` - will be used. - * If ``tooltip`` is ``{"content": "data"}``, then all fields that appear in the - highlighted data point will be used. - * If set to ``null``, then no tooltip will be used. - width : float - Width of the marks. - x : anyOf(float, enum('width')) - X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without - specified ``x2`` or ``width``. + Attributes + ---------- - The ``value`` of this channel can be a number or a string ``"width"`` for the width - of the plot. - x2 : anyOf(float, enum('width')) - X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + scheme : string - The ``value`` of this channel can be a number or a string ``"width"`` for the width - of the plot. - y : anyOf(float, enum('height')) - Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without - specified ``y2`` or ``height``. + count : float - The ``value`` of this channel can be a number or a string ``"height"`` for the - height of the plot. - y2 : anyOf(float, enum('width')) - Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + extent : List(float) - The ``value`` of this channel can be a number or a string ``"height"`` for the - height of the plot. """ - _schema = {'$ref': '#/definitions/RectConfig'} + _schema = {'$ref': '#/definitions/SchemeConfig'} _rootschema = Root._schema - def __init__(self, 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, height=Undefined, href=Undefined, interpolate=Undefined, - limit=Undefined, opacity=Undefined, order=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, width=Undefined, x=Undefined, x2=Undefined, y=Undefined, - y2=Undefined, **kwds): - super(RectConfig, self).__init__(align=align, angle=angle, baseline=baseline, - binSpacing=binSpacing, color=color, - continuousBandSize=continuousBandSize, - cornerRadius=cornerRadius, cursor=cursor, dir=dir, - discreteBandSize=discreteBandSize, dx=dx, dy=dy, - ellipsis=ellipsis, fill=fill, fillOpacity=fillOpacity, - filled=filled, font=font, fontSize=fontSize, - fontStyle=fontStyle, fontWeight=fontWeight, height=height, - href=href, interpolate=interpolate, limit=limit, - opacity=opacity, order=order, orient=orient, radius=radius, - shape=shape, size=size, stroke=stroke, strokeCap=strokeCap, - strokeDash=strokeDash, strokeDashOffset=strokeDashOffset, - strokeJoin=strokeJoin, strokeMiterLimit=strokeMiterLimit, - strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, - tension=tension, text=text, theta=theta, tooltip=tooltip, - width=width, x=x, x2=x2, y=y, y2=y2, **kwds) + def __init__(self, scheme=Undefined, count=Undefined, extent=Undefined, **kwds): + super(SchemeConfig, self).__init__(scheme=scheme, count=count, extent=extent, **kwds) -class RepeatMapping(VegaLiteSchema): - """RepeatMapping schema wrapper +class SchemeParams(VegaLiteSchema): + """SchemeParams schema wrapper - Mapping(required=[]) + Mapping(required=[name]) Attributes ---------- - column : List(string) - An array of fields to be repeated horizontally. - row : List(string) - An array of fields to be repeated vertically. + name : string + A color scheme name for ordinal scales (e.g., ``"category10"`` or ``"blues"`` ). + + For the full list of supported schemes, please refer to the `Vega Scheme + `__ reference. + count : float + The number of colors to use in the scheme. This can be useful for scale types such + as ``"quantize"``, which use the length of the scale range to determine the number + of discrete bins for the scale domain. + extent : List(float) + 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. """ - _schema = {'$ref': '#/definitions/RepeatMapping'} + _schema = {'$ref': '#/definitions/SchemeParams'} _rootschema = Root._schema - def __init__(self, column=Undefined, row=Undefined, **kwds): - super(RepeatMapping, self).__init__(column=column, row=row, **kwds) + def __init__(self, name=Undefined, count=Undefined, extent=Undefined, **kwds): + super(SchemeParams, self).__init__(name=name, count=count, extent=extent, **kwds) -class RepeatRef(VegaLiteSchema): - """RepeatRef schema wrapper +class SecondaryFieldDef(VegaLiteSchema): + """SecondaryFieldDef schema wrapper - Mapping(required=[repeat]) - A ValueDef with optional Condition - Reference to a repeated value. + Mapping(required=[]) + A field definition of a secondary channel that shares a scale with another primary channel. + For example, ``x2``, ``xError`` and ``xError2`` share the same scale with ``x``. Attributes ---------- - repeat : enum('row', 'column', 'repeat') + aggregate : :class:`Aggregate` + Aggregation function for the field + (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). + + **Default value:** ``undefined`` (None) + + **See also:** `aggregate `__ + documentation. + bin : None + A flag for binning a ``quantitative`` field, `an object defining binning parameters + `__, or indicating that the + data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite ( + ``"binned"`` ). + + + If ``true``, default `binning parameters + `__ will be applied. + + If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are + already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end + field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to + binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also + set the axis's `tickMinStep + `__ property. + + **Default value:** ``false`` + + **See also:** `bin `__ + documentation. + field : :class:`Field` + **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. + + **See also:** `field `__ + documentation. + + **Notes:** + 1) 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 + `__. + 2) ``field`` is not required if ``aggregate`` is ``count``. + timeUnit : :class:`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) + + **See also:** `timeUnit `__ + documentation. + 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`` and ``timeUnit`` ). 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 legend ``title`` are + defined, axis/header/legend title will be used. """ - _schema = {'$ref': '#/definitions/RepeatRef'} + _schema = {'$ref': '#/definitions/SecondaryFieldDef'} _rootschema = Root._schema - def __init__(self, repeat=Undefined, **kwds): - super(RepeatRef, self).__init__(repeat=repeat, **kwds) + def __init__(self, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, + title=Undefined, **kwds): + super(SecondaryFieldDef, self).__init__(aggregate=aggregate, bin=bin, field=field, + timeUnit=timeUnit, title=title, **kwds) -class Resolve(VegaLiteSchema): - """Resolve schema wrapper +class SelectionConfig(VegaLiteSchema): + """SelectionConfig schema wrapper Mapping(required=[]) - Defines how scales, axes, and legends from different specs should be combined. Resolve is a - mapping from ``scale``, ``axis``, and ``legend`` to a mapping from channels to resolutions. Attributes ---------- - axis : :class:`AxisResolveMap` + interval : :class:`IntervalSelectionConfig` + The default definition for an `interval + `__ selection. All + properties and transformations + for an interval selection definition (except ``type`` ) may be specified here. - legend : :class:`LegendResolveMap` + For instance, setting ``interval`` to ``{"translate": false}`` disables the ability + to move + interval selections by default. + multi : :class:`MultiSelectionConfig` + The default definition for a `multi + `__ selection. All + properties and transformations + for a multi selection definition (except ``type`` ) may be specified here. - scale : :class:`ScaleResolveMap` + For instance, setting ``multi`` to ``{"toggle": "event.altKey"}`` adds additional + values to + multi selections when clicking with the alt-key pressed by default. + single : :class:`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. """ - _schema = {'$ref': '#/definitions/Resolve'} + _schema = {'$ref': '#/definitions/SelectionConfig'} _rootschema = Root._schema - def __init__(self, axis=Undefined, legend=Undefined, scale=Undefined, **kwds): - super(Resolve, self).__init__(axis=axis, legend=legend, scale=scale, **kwds) + def __init__(self, interval=Undefined, multi=Undefined, single=Undefined, **kwds): + super(SelectionConfig, self).__init__(interval=interval, multi=multi, single=single, **kwds) -class ResolveMode(VegaLiteSchema): - """ResolveMode schema wrapper +class SelectionDef(VegaLiteSchema): + """SelectionDef schema wrapper - enum('independent', 'shared') + anyOf(:class:`SingleSelection`, :class:`MultiSelection`, :class:`IntervalSelection`) """ - _schema = {'$ref': '#/definitions/ResolveMode'} + _schema = {'$ref': '#/definitions/SelectionDef'} _rootschema = Root._schema - def __init__(self, *args): - super(ResolveMode, self).__init__(*args) + def __init__(self, *args, **kwds): + super(SelectionDef, self).__init__(*args, **kwds) -class RowColLayoutAlign(VegaLiteSchema): - """RowColLayoutAlign schema wrapper +class IntervalSelection(SelectionDef): + """IntervalSelection schema wrapper - Mapping(required=[]) + Mapping(required=[type]) Attributes ---------- - column : :class:`LayoutAlign` - - row : :class:`LayoutAlign` - - """ - _schema = {'$ref': '#/definitions/RowCol'} - _rootschema = Root._schema - - def __init__(self, column=Undefined, row=Undefined, **kwds): - super(RowColLayoutAlign, self).__init__(column=column, row=row, **kwds) - + type : enum('interval') + Determines the default event processing and data query for the selection. Vega-Lite + currently supports three selection types: -class RowColboolean(VegaLiteSchema): - """RowColboolean schema wrapper - Mapping(required=[]) + * ``single`` -- to select a single discrete data value on ``click``. + * ``multi`` -- to select multiple discrete data value; the first value is selected + on ``click`` and additional values toggled on shift- ``click``. + * ``interval`` -- to select a continuous range of data values on ``drag``. + 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. - Attributes - ---------- + **See also:** `bind `__ + documentation. + clear : anyOf(:class:`EventStream`, boolean) + Clears the selection, emptying it of all values. Can be an + `EventStream `__ or ``false`` to + disable. - column : boolean + **Default value:** ``dblclick``. - row : boolean + **See also:** `clear `__ + documentation. + 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(:class:`SingleDefUnitChannel`) + An array of encoding channels. The corresponding data field values + must match for a data tuple to fall within the selection. - """ - _schema = {'$ref': '#/definitions/RowCol'} - _rootschema = Root._schema + **See also:** `encodings `__ + documentation. + fields : List(:class:`FieldName`) + An array of field names whose values must match for a data tuple to + fall within the selection. - def __init__(self, column=Undefined, row=Undefined, **kwds): - super(RowColboolean, self).__init__(column=column, row=row, **kwds) + **See also:** `fields `__ + documentation. + init : :class:`SelectionInitIntervalMapping` + Initialize the selection with a mapping between `projected channels or field names + `__ and arrays of + initial values. + **See also:** `init `__ + documentation. + mark : :class:`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. -class RowColnumber(VegaLiteSchema): - """RowColnumber schema wrapper + **See also:** `mark `__ + documentation. + on : :class:`EventStream` + A `Vega event stream `__ (object or + selector) that triggers the selection. + For interval selections, the event stream must specify a `start and end + `__. + resolve : :class:`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. - Mapping(required=[]) + **See also:** `resolve + `__ documentation. + 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. - Attributes - ---------- + **Default value:** ``true``, which corresponds to + ``[mousedown, window:mouseup] > window:mousemove!`` which corresponds to + clicks and dragging within an interval selection to reposition it. - column : float + **See also:** `translate `__ + documentation. + 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, + only ``wheel`` events are supported. - row : float + **Default value:** ``true``, which corresponds to ``wheel!``. + **See also:** `zoom `__ + documentation. """ - _schema = {'$ref': '#/definitions/RowCol'} + _schema = {'$ref': '#/definitions/IntervalSelection'} _rootschema = Root._schema - def __init__(self, column=Undefined, row=Undefined, **kwds): - super(RowColnumber, self).__init__(column=column, row=row, **kwds) + def __init__(self, type=Undefined, bind=Undefined, clear=Undefined, empty=Undefined, + encodings=Undefined, fields=Undefined, init=Undefined, mark=Undefined, on=Undefined, + resolve=Undefined, translate=Undefined, zoom=Undefined, **kwds): + super(IntervalSelection, self).__init__(type=type, bind=bind, clear=clear, empty=empty, + encodings=encodings, fields=fields, init=init, + mark=mark, on=on, resolve=resolve, translate=translate, + zoom=zoom, **kwds) -class SampleTransform(VegaLiteSchema): - """SampleTransform schema wrapper +class MultiSelection(SelectionDef): + """MultiSelection schema wrapper - Mapping(required=[sample]) + Mapping(required=[type]) Attributes ---------- - sample : float - The maximum number of data objects to include in the sample. - - **Default value:** ``1000`` - """ - _schema = {'$ref': '#/definitions/SampleTransform'} - _rootschema = Root._schema + type : enum('multi') + Determines the default event processing and data query for the selection. Vega-Lite + currently supports three selection types: - def __init__(self, sample=Undefined, **kwds): - super(SampleTransform, self).__init__(sample=sample, **kwds) + * ``single`` -- to select a single discrete data value on ``click``. + * ``multi`` -- to select multiple discrete data value; the first value is selected + on ``click`` and additional values toggled on shift- ``click``. + * ``interval`` -- to select a continuous range of data values on ``drag``. + clear : anyOf(:class:`EventStream`, boolean) + Clears the selection, emptying it of all values. Can be an + `EventStream `__ or ``false`` to + disable. -class Scale(VegaLiteSchema): - """Scale schema wrapper + **Default value:** ``dblclick``. - Mapping(required=[]) + **See also:** `clear `__ + documentation. + 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(:class:`SingleDefUnitChannel`) + An array of encoding channels. The corresponding data field values + must match for a data tuple to fall within the selection. - Attributes - ---------- + **See also:** `encodings `__ + documentation. + fields : List(:class:`FieldName`) + An array of field names whose values must match for a data tuple to + fall within the selection. - align : float - The alignment of the steps within the scale range. + **See also:** `fields `__ + documentation. + init : anyOf(:class:`SelectionInitMapping`, List(:class:`SelectionInitMapping`)) + Initialize the selection with a mapping between `projected channels or field names + `__ and an initial + value (or array of values). - This value must lie in the range ``[0,1]``. A value of ``0.5`` indicates that the - steps should be centered within the range. A value of ``0`` or ``1`` may be used to - shift the bands to one side, say to position them adjacent to an axis. + **See also:** `init `__ + documentation. + 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. - **Default value:** ``0.5`` - base : float - The logarithm base of the ``log`` scale (default ``10`` ). - bins : List(float) - An array of bin boundaries over the scale domain. If provided, axes and legends will - use the bin boundaries to inform the choice of tick marks and text labels. - clamp : boolean - If ``true``, values that exceed the data domain are clamped to either the minimum or - maximum range value + **See also:** `nearest `__ + documentation. + on : :class:`EventStream` + A `Vega event stream `__ (object or + selector) that triggers the selection. + For interval selections, the event stream must specify a `start and end + `__. + resolve : :class:`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. - **Default value:** derived from the `scale config - `__ 's ``clamp`` ( - ``true`` by default). - constant : float - A constant determining the slope of the symlog function around zero. Only used for - ``symlog`` scales. + **See also:** `resolve + `__ documentation. + 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:** ``1`` - domain : anyOf(List(float), List(string), List(boolean), List(:class:`DateTime`), - enum('unaggregated'), :class:`SelectionDomain`) - Customized domain values. + **Default value:** ``true``, which corresponds to ``event.shiftKey`` (i.e., + data values are toggled when a user interacts with the shift-key pressed). - 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 a ``domain`` 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. + **See also:** `toggle `__ + documentation. + """ + _schema = {'$ref': '#/definitions/MultiSelection'} + _rootschema = Root._schema - 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 - `__. + def __init__(self, type=Undefined, clear=Undefined, empty=Undefined, encodings=Undefined, + fields=Undefined, init=Undefined, nearest=Undefined, on=Undefined, resolve=Undefined, + toggle=Undefined, **kwds): + super(MultiSelection, self).__init__(type=type, clear=clear, empty=empty, encodings=encodings, + fields=fields, init=init, nearest=nearest, on=on, + resolve=resolve, toggle=toggle, **kwds) - 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(:class:`ScaleInterpolate`, :class:`ScaleInterpolateParams`) - The interpolation method for range values. By default, a general interpolator for - numbers, dates, strings and colors (in HCL 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`` and - ``cubehelix-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 - `__. +class SelectionDomain(VegaLiteSchema): + """SelectionDomain schema wrapper + anyOf(Mapping(required=[selection]), Mapping(required=[selection])) + """ + _schema = {'$ref': '#/definitions/SelectionDomain'} + _rootschema = Root._schema - * **Default value:** ``hcl`` - nice : anyOf(boolean, float, :class:`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]*. + def __init__(self, *args, **kwds): + super(SelectionDomain, self).__init__(*args, **kwds) - For quantitative scales such as linear, ``nice`` can be either a boolean flag or a - number. If ``nice`` 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`` and ``utc`` 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. +class SelectionInit(VegaLiteSchema): + """SelectionInit schema wrapper - **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. + anyOf(boolean, float, string, :class:`DateTime`) + """ + _schema = {'$ref': '#/definitions/SelectionInit'} + _rootschema = Root._schema - For * `band `__ * scales, - shortcut for setting ``paddingInner`` and ``paddingOuter`` to the same value. + def __init__(self, *args, **kwds): + super(SelectionInit, self).__init__(*args, **kwds) - For * `point `__ * scales, - alias for ``paddingOuter``. - **Default value:** For *continuous* scales, derived from the `scale config - `__ 's - ``continuousPadding``. - For *band and point* scales, see ``paddingInner`` and ``paddingOuter``. By default, - Vega-Lite sets padding such that *width/height = number of unique values * step*. - 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]. +class DateTime(SelectionInit): + """DateTime schema wrapper - For point scale, this property is invalid as point scales do not have internal band - widths (only step sizes between bands). + 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. - **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]. + Attributes + ---------- - **Default value:** derived from the `scale config - `__ 's ``bandPaddingOuter`` - for band scales and ``pointPadding`` for point scales. - By default, Vega-Lite sets outer padding such that *width/height = number of unique - values * step*. - range : anyOf(List(float), List(string), string) - The range of the scale. One of: + date : float + Integer value representing the date from 1-31. + day : anyOf(:class:`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"`` ). :raw-html:`
` + **Warning:** A DateTime definition object with ``day`` ** should not be combined + with ``year``, ``quarter``, ``month``, or ``date``. + 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(:class:`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. + """ + _schema = {'$ref': '#/definitions/DateTime'} + _rootschema = Root._schema + def __init__(self, date=Undefined, day=Undefined, hours=Undefined, milliseconds=Undefined, + minutes=Undefined, month=Undefined, quarter=Undefined, seconds=Undefined, + utc=Undefined, year=Undefined, **kwds): + super(DateTime, self).__init__(date=date, day=day, hours=hours, milliseconds=milliseconds, + minutes=minutes, month=month, quarter=quarter, seconds=seconds, + utc=utc, year=year, **kwds) - 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 - `__. +class SelectionInitInterval(VegaLiteSchema): + """SelectionInitInterval schema wrapper - For `discrete `__ and - `discretizing `__ - scales, an array of desired output values. + anyOf(List([boolean, boolean]), List([float, float]), List([string, string]), + List([:class:`DateTime`, :class:`DateTime`])) + """ + _schema = {'$ref': '#/definitions/SelectionInitInterval'} + _rootschema = Root._schema - **Notes:** + def __init__(self, *args, **kwds): + super(SelectionInitInterval, self).__init__(*args, **kwds) - 1) For color scales you can also specify a color `scheme - `__ instead of ``range``. - 2) Any directly specified ``range`` for ``x`` and ``y`` channels will be ignored. - Range can be customized via the view's corresponding `size - `__ ( ``width`` and ``height`` ) or - via `range steps and paddings properties <#range-step>`__ for `band <#band>`__ and - `point <#point>`__ scales. - rangeStep : anyOf(float, None) - The distance between the starts of adjacent bands or points in `band - `__ and `point - `__ scales. +class SelectionInitIntervalMapping(VegaLiteSchema): + """SelectionInitIntervalMapping schema wrapper - If ``rangeStep`` is ``null`` or if the view contains the scale's corresponding `size - `__ ( ``width`` for ``x`` scales - and ``height`` for ``y`` scales), ``rangeStep`` will be automatically determined to - fit the size of the view. + Mapping(required=[]) + """ + _schema = {'$ref': '#/definitions/SelectionInitIntervalMapping'} + _rootschema = Root._schema - **Default value:** derived the `scale config - `__ 's - ``textXRangeStep`` ( ``90`` by default) for x-scales of ``text`` marks and - ``rangeStep`` ( ``21`` by default) for x-scales of other marks and y-scales. + def __init__(self, **kwds): + super(SelectionInitIntervalMapping, self).__init__(**kwds) - **Warning** : If ``rangeStep`` is ``null`` and the cardinality of the scale's domain - is higher than ``width`` or ``height``, 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, :class:`SchemeParams`) - A string indicating a color `scheme - `__ name (e.g., - ``"category10"`` or ``"blues"`` ) or a `scheme parameter object - `__. +class SelectionInitMapping(VegaLiteSchema): + """SelectionInitMapping schema wrapper - Discrete color schemes may be used with `discrete - `__ or `discretizing - `__ scales. - Continuous color schemes are intended for use with color scales. + Mapping(required=[]) + """ + _schema = {'$ref': '#/definitions/SelectionInitMapping'} + _rootschema = Root._schema - For the full list of supported schemes, please refer to the `Vega Scheme - `__ reference. - type : :class:`ScaleType` - The type of scale. Vega-Lite supports the following categories of scale types: + def __init__(self, **kwds): + super(SelectionInitMapping, self).__init__(**kwds) - 1) `Continuous Scales - `__ -- mapping - continuous domains to continuous output ranges ( `"linear" - `__, `"pow" - `__, `"sqrt" - `__, `"symlog" - `__, `"log" - `__, `"time" - `__, `"utc" - `__. - 2) `Discrete Scales `__ - -- mapping discrete domains to discrete ( `"ordinal" - `__ ) or continuous ( - `"band" `__ and `"point" - `__ ) output ranges. +class SelectionOperand(VegaLiteSchema): + """SelectionOperand schema wrapper - 3) `Discretizing Scales - `__ -- mapping - continuous domains to discrete output ranges `"bin-ordinal" - `__, `"quantile" - `__, `"quantize" - `__ and `"threshold" - `__. + anyOf(:class:`SelectionNot`, :class:`SelectionAnd`, :class:`SelectionOr`, string) + """ + _schema = {'$ref': '#/definitions/SelectionOperand'} + _rootschema = Root._schema + + def __init__(self, *args, **kwds): + super(SelectionOperand, self).__init__(*args, **kwds) - **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 custom ``domain`` is provided; ``false`` otherwise. +class SelectionAnd(SelectionOperand): + """SelectionAnd schema wrapper + + Mapping(required=[and]) + + Attributes + ---------- + + and : List(:class:`SelectionOperand`) - **Note:** Log, time, and utc scales do not support ``zero``. """ - _schema = {'$ref': '#/definitions/Scale'} + _schema = {'$ref': '#/definitions/SelectionAnd'} _rootschema = Root._schema - def __init__(self, align=Undefined, base=Undefined, bins=Undefined, clamp=Undefined, - constant=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): - super(Scale, self).__init__(align=align, base=base, bins=bins, clamp=clamp, constant=constant, - domain=domain, exponent=exponent, interpolate=interpolate, - nice=nice, padding=padding, paddingInner=paddingInner, - paddingOuter=paddingOuter, range=range, rangeStep=rangeStep, - round=round, scheme=scheme, type=type, zero=zero, **kwds) + def __init__(self, **kwds): + super(SelectionAnd, self).__init__(**kwds) -class ScaleConfig(VegaLiteSchema): - """ScaleConfig schema wrapper +class SelectionNot(SelectionOperand): + """SelectionNot schema wrapper - Mapping(required=[]) + Mapping(required=[not]) Attributes ---------- - bandPaddingInner : float - Default inner padding for ``x`` and ``y`` band-ordinal scales. + not : :class:`SelectionOperand` - **Default value:** + """ + _schema = {'$ref': '#/definitions/SelectionNot'} + _rootschema = Root._schema + def __init__(self, **kwds): + super(SelectionNot, self).__init__(**kwds) - * ``barBandPaddingInner`` for bar marks ( ``0.1`` by default) - * ``rectBandPaddingInner`` for rect and other marks ( ``0`` by default) - bandPaddingOuter : float - Default outer padding for ``x`` and ``y`` band-ordinal scales. - **Default value:** ``paddingInner/2`` (which makes *width/height = number of unique - values * step* ) - barBandPaddingInner : float - Default inner padding for ``x`` and ``y`` band-ordinal scales of ``"bar"`` marks. +class SelectionOr(SelectionOperand): + """SelectionOr schema wrapper - **Default value:** ``0.1`` - barBandPaddingOuter : float - Default outer padding for ``x`` and ``y`` band-ordinal scales of ``"bar"`` marks. - 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. + Mapping(required=[or]) - **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. + Attributes + ---------- - 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. + or : List(:class:`SelectionOperand`) - **Default value:** ``40`` - maxOpacity : float - Default max opacity for mapping a field to opacity. + """ + _schema = {'$ref': '#/definitions/SelectionOr'} + _rootschema = Root._schema - **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. + def __init__(self, **kwds): + super(SelectionOr, self).__init__(**kwds) - **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 +class SelectionPredicate(Predicate): + """SelectionPredicate schema wrapper - **Default value:** ``8`` - minOpacity : float - Default minimum opacity for mapping a field to opacity. + Mapping(required=[selection]) - **Default value:** ``0.3`` - minSize : float - Default minimum value for point size scale with zero=false. + Attributes + ---------- - **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. + selection : :class:`SelectionOperand` + Filter using a selection name. + """ + _schema = {'$ref': '#/definitions/SelectionPredicate'} + _rootschema = Root._schema - **Default value:** ``1`` - pointPadding : float - Default outer padding for ``x`` and ``y`` point-ordinal scales. + def __init__(self, selection=Undefined, **kwds): + super(SelectionPredicate, self).__init__(selection=selection, **kwds) - **Default value:** ``0.5`` (which makes *width/height = number of unique values * - step* ) - quantileCount : float - Default range cardinality for `quantile - `__ scale. - **Default value:** ``4`` - quantizeCount : float - Default range cardinality for `quantize - `__ scale. +class SelectionResolution(VegaLiteSchema): + """SelectionResolution schema wrapper - **Default value:** ``4`` - rangeStep : anyOf(float, None) - Default range step for band and point scales of (1) the ``y`` channel - and (2) the ``x`` channel when the mark is not ``text``. + enum('global', 'union', 'intersect') + """ + _schema = {'$ref': '#/definitions/SelectionResolution'} + _rootschema = Root._schema - **Default value:** ``20`` - rectBandPaddingInner : float - Default inner padding for ``x`` and ``y`` band-ordinal scales of ``"rect"`` marks. + def __init__(self, *args): + super(SelectionResolution, self).__init__(*args) - **Default value:** ``0`` - rectBandPaddingOuter : float - Default outer padding for ``x`` and ``y`` band-ordinal scales of ``"rect"`` marks. - If not specified, by default, band scale's paddingOuter is paddingInner/2. - 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``, and ``size`` 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. +class SequenceGenerator(Generator): + """SequenceGenerator schema wrapper - This is equivalent to setting ``domain`` to ``"unaggregate"`` for aggregated - *quantitative* fields by default. + Mapping(required=[sequence]) - 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. + Attributes + ---------- - **Default value:** ``false`` + sequence : :class:`SequenceParams` + Generate a sequence of numbers. + name : string + Provide a placeholder name and bind data at runtime. """ - _schema = {'$ref': '#/definitions/ScaleConfig'} + _schema = {'$ref': '#/definitions/SequenceGenerator'} _rootschema = Root._schema - def __init__(self, bandPaddingInner=Undefined, bandPaddingOuter=Undefined, - barBandPaddingInner=Undefined, barBandPaddingOuter=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, quantileCount=Undefined, - quantizeCount=Undefined, rangeStep=Undefined, rectBandPaddingInner=Undefined, - rectBandPaddingOuter=Undefined, round=Undefined, textXRangeStep=Undefined, - useUnaggregatedDomain=Undefined, **kwds): - super(ScaleConfig, self).__init__(bandPaddingInner=bandPaddingInner, - bandPaddingOuter=bandPaddingOuter, - barBandPaddingInner=barBandPaddingInner, - barBandPaddingOuter=barBandPaddingOuter, clamp=clamp, - continuousPadding=continuousPadding, maxBandSize=maxBandSize, - maxFontSize=maxFontSize, maxOpacity=maxOpacity, - maxSize=maxSize, maxStrokeWidth=maxStrokeWidth, - minBandSize=minBandSize, minFontSize=minFontSize, - minOpacity=minOpacity, minSize=minSize, - minStrokeWidth=minStrokeWidth, pointPadding=pointPadding, - quantileCount=quantileCount, quantizeCount=quantizeCount, - rangeStep=rangeStep, - rectBandPaddingInner=rectBandPaddingInner, - rectBandPaddingOuter=rectBandPaddingOuter, round=round, - textXRangeStep=textXRangeStep, - useUnaggregatedDomain=useUnaggregatedDomain, **kwds) + def __init__(self, sequence=Undefined, name=Undefined, **kwds): + super(SequenceGenerator, self).__init__(sequence=sequence, name=name, **kwds) -class ScaleInterpolate(VegaLiteSchema): - """ScaleInterpolate schema wrapper +class SequenceParams(VegaLiteSchema): + """SequenceParams schema wrapper - enum('rgb', 'lab', 'hcl', 'hsl', 'hsl-long', 'hcl-long', 'cubehelix', 'cubehelix-long') + Mapping(required=[start, stop]) + + Attributes + ---------- + + start : float + The starting value of the sequence (inclusive). + stop : float + The ending value of the sequence (exclusive). + step : float + The step value between sequence entries. + + **Default value:** ``1`` + as : :class:`FieldName` + The name of the generated sequence field. + + **Default value:** ``"data"`` """ - _schema = {'$ref': '#/definitions/ScaleInterpolate'} + _schema = {'$ref': '#/definitions/SequenceParams'} _rootschema = Root._schema - def __init__(self, *args): - super(ScaleInterpolate, self).__init__(*args) + def __init__(self, start=Undefined, stop=Undefined, step=Undefined, **kwds): + super(SequenceParams, self).__init__(start=start, stop=stop, step=step, **kwds) + + +class ShapeFieldDefWithCondition(VegaLiteSchema): + """ShapeFieldDefWithCondition schema wrapper + + Mapping(required=[type]) + A FieldDef with Condition :raw-html:`` + + Attributes + ---------- + + type : :class:`TypeForShape` + The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, + ``"ordinal"``, or ``"nominal"`` ). + It can also be a ``"geojson"`` type for encoding `'geoshape' + `__. + + **Note:** + + + * Data values for a temporal field can be either a date-time string (e.g., + ``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a + timestamp number (e.g., ``1552199579097`` ). + * Data ``type`` describes the semantics of the data rather than the primitive data + types ( ``number``, ``string``, etc.). The same primitive data type can have + different types of measurement. For example, numeric data can represent + quantitative, ordinal, or nominal data. + * When using with `bin `__, the + ``type`` property can be either ``"quantitative"`` (for using a linear bin scale) + or `"ordinal" (for using an ordinal bin scale) + `__. + * When using with `timeUnit + `__, the ``type`` property + can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using + an ordinal scale) `__. + * When using with `aggregate + `__, the ``type`` property + refers to the post-aggregation data type. For example, we can calculate count + ``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct", + "field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output + is ``"quantitative"``. + * Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have + ``type`` as they have exactly the same type as their primary channels (e.g., + ``x``, ``y`` ). + + **See also:** `type `__ + documentation. + aggregate : :class:`Aggregate` + Aggregation function for the field + (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). + **Default value:** ``undefined`` (None) -class ScaleInterpolateParams(VegaLiteSchema): - """ScaleInterpolateParams schema wrapper + **See also:** `aggregate `__ + documentation. + bin : anyOf(boolean, :class:`BinParams`, None) + A flag for binning a ``quantitative`` field, `an object defining binning parameters + `__, or indicating that the + data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite ( + ``"binned"`` ). - Mapping(required=[type]) - Attributes - ---------- + If ``true``, default `binning parameters + `__ will be applied. - type : enum('rgb', 'cubehelix', 'cubehelix-long') + If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are + already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end + field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to + binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also + set the axis's `tickMinStep + `__ property. - gamma : float + **Default value:** ``false`` - """ - _schema = {'$ref': '#/definitions/ScaleInterpolateParams'} - _rootschema = Root._schema + **See also:** `bin `__ + documentation. + condition : anyOf(:class:`ConditionalStringValueDef`, + List(:class:`ConditionalStringValueDef`)) + One or more value definition(s) with `a selection or a test predicate + `__. - def __init__(self, type=Undefined, gamma=Undefined, **kwds): - super(ScaleInterpolateParams, self).__init__(type=type, gamma=gamma, **kwds) + **Note:** A field definition's ``condition`` property can only contain `conditional + value definitions `__ + since Vega-Lite only allows at most one encoded field per encoding channel. + field : :class:`Field` + **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. + **See also:** `field `__ + documentation. -class ScaleResolveMap(VegaLiteSchema): - """ScaleResolveMap schema wrapper + **Notes:** + 1) 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 + `__. + 2) ``field`` is not required if ``aggregate`` is ``count``. + legend : anyOf(:class:`Legend`, None) + An object defining properties of the legend. + If ``null``, the legend for the encoding channel will be removed. - Mapping(required=[]) + **Default value:** If undefined, default `legend properties + `__ are applied. - Attributes - ---------- + **See also:** `legend `__ + documentation. + scale : anyOf(:class:`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. - color : :class:`ResolveMode` + If ``null``, the scale will be `disabled and the data value will be directly encoded + `__. - fill : :class:`ResolveMode` + **Default value:** If undefined, default `scale properties + `__ are applied. - fillOpacity : :class:`ResolveMode` + **See also:** `scale `__ + documentation. + sort : :class:`Sort` + Sort order for the encoded field. - opacity : :class:`ResolveMode` + For continuous fields (quantitative or temporal), ``sort`` can be either + ``"ascending"`` or ``"descending"``. - shape : :class:`ResolveMode` + For discrete fields, ``sort`` can be one of the following: - size : :class:`ResolveMode` - stroke : :class:`ResolveMode` + * ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in + Javascript. + * `A sort-by-encoding definition + `__ for sorting + by another encoding channel. (This type of sort definition is not available for + ``row`` and ``column`` channels.) + * `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. - strokeOpacity : :class:`ResolveMode` + **Default value:** ``"ascending"`` - strokeWidth : :class:`ResolveMode` + **Note:** ``null`` is not supported for ``row`` and ``column``. - x : :class:`ResolveMode` + **See also:** `sort `__ + documentation. + timeUnit : :class:`TimeUnit` + Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal + field. + or `a temporal field that gets casted as ordinal + `__. - y : :class:`ResolveMode` + **Default value:** ``undefined`` (None) - """ - _schema = {'$ref': '#/definitions/ScaleResolveMap'} - _rootschema = Root._schema + **See also:** `timeUnit `__ + documentation. + title : anyOf(string, None) + A title for the field. If ``null``, the title will be removed. - def __init__(self, color=Undefined, fill=Undefined, fillOpacity=Undefined, opacity=Undefined, - shape=Undefined, size=Undefined, stroke=Undefined, strokeOpacity=Undefined, - strokeWidth=Undefined, x=Undefined, y=Undefined, **kwds): - super(ScaleResolveMap, self).__init__(color=color, fill=fill, fillOpacity=fillOpacity, - opacity=opacity, shape=shape, size=size, stroke=stroke, - strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, x=x, - y=y, **kwds) + **Default value:** derived from the field's name and transformation function ( + ``aggregate``, ``bin`` and ``timeUnit`` ). 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** : -class ScaleType(VegaLiteSchema): - """ScaleType schema wrapper + 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 + `__. - enum('linear', 'log', 'pow', 'sqrt', 'symlog', 'time', 'utc', 'quantile', 'quantize', - 'threshold', 'bin-ordinal', 'ordinal', 'point', 'band') + 2) If both field definition's ``title`` and axis, header, or legend ``title`` are + defined, axis/header/legend title will be used. """ - _schema = {'$ref': '#/definitions/ScaleType'} + _schema = {'$ref': '#/definitions/ShapeFieldDefWithCondition'} _rootschema = Root._schema - def __init__(self, *args): - super(ScaleType, self).__init__(*args) + def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, + field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, + title=Undefined, **kwds): + super(ShapeFieldDefWithCondition, self).__init__(type=type, aggregate=aggregate, bin=bin, + condition=condition, field=field, + legend=legend, scale=scale, sort=sort, + timeUnit=timeUnit, title=title, **kwds) -class SchemeConfig(VegaLiteSchema): - """SchemeConfig schema wrapper +class ShapeValueDefWithCondition(VegaLiteSchema): + """ShapeValueDefWithCondition schema wrapper - Mapping(required=[scheme]) + Mapping(required=[]) + A ValueDef with Condition where either the condition or the value are + optional. Attributes ---------- - scheme : string - - count : float - - extent : List(float) - + condition : anyOf(:class:`ConditionalMarkPropFieldDefTypeForShape`, + :class:`ConditionalStringValueDef`, List(:class:`ConditionalStringValueDef`)) + A field definition or one or more value definition(s) with a selection predicate. + value : anyOf(string, None) + A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values + between ``0`` to ``1`` for opacity). """ - _schema = {'$ref': '#/definitions/SchemeConfig'} + _schema = {'$ref': '#/definitions/ShapeValueDefWithCondition'} _rootschema = Root._schema - def __init__(self, scheme=Undefined, count=Undefined, extent=Undefined, **kwds): - super(SchemeConfig, self).__init__(scheme=scheme, count=count, extent=extent, **kwds) + def __init__(self, condition=Undefined, value=Undefined, **kwds): + super(ShapeValueDefWithCondition, self).__init__(condition=condition, value=value, **kwds) -class SchemeParams(VegaLiteSchema): - """SchemeParams schema wrapper +class SignalRef(LayoutBounds): + """SignalRef schema wrapper - Mapping(required=[name]) + Mapping(required=[signal]) Attributes ---------- - name : string - A color scheme name for ordinal scales (e.g., ``"category10"`` or ``"blues"`` ). + signal : string - For the full list of supported schemes, please refer to the `Vega Scheme - `__ reference. - count : float - The number of colors to use in the scheme. This can be useful for scale types such - as ``"quantize"``, which use the length of the scale range to determine the number - of discrete bins for the scale domain. - extent : List(float) - 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. """ - _schema = {'$ref': '#/definitions/SchemeParams'} + _schema = {'$ref': '#/definitions/SignalRef'} _rootschema = Root._schema - def __init__(self, name=Undefined, count=Undefined, extent=Undefined, **kwds): - super(SchemeParams, self).__init__(name=name, count=count, extent=extent, **kwds) - + def __init__(self, signal=Undefined, **kwds): + super(SignalRef, self).__init__(signal=signal, **kwds) -class SecondaryFieldDef(VegaLiteSchema): - """SecondaryFieldDef schema wrapper - Mapping(required=[]) - A field definition of a secondary channel that shares a scale with another primary channel. - For example, ``x2``, ``xError`` and ``xError2`` share the same scale with ``x``. +class SingleDefUnitChannel(VegaLiteSchema): + """SingleDefUnitChannel schema wrapper - Attributes - ---------- + enum('x', 'y', 'x2', 'y2', 'longitude', 'latitude', 'longitude2', 'latitude2', 'color', + 'fill', 'stroke', 'opacity', 'fillOpacity', 'strokeOpacity', 'strokeWidth', 'size', 'shape', + 'key', 'text', 'tooltip', 'href') + """ + _schema = {'$ref': '#/definitions/SingleDefUnitChannel'} + _rootschema = Root._schema - aggregate : :class:`Aggregate` - Aggregation function for the field - (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). + def __init__(self, *args): + super(SingleDefUnitChannel, self).__init__(*args) - **Default value:** ``undefined`` (None) - **See also:** `aggregate `__ - documentation. - bin : None - A flag for binning a ``quantitative`` field, `an object defining binning parameters - `__, or indicating that the - data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite ( - ``"binned"`` ). +class SingleSelection(SelectionDef): + """SingleSelection schema wrapper + Mapping(required=[type]) - If ``true``, default `binning parameters - `__ will be applied. + Attributes + ---------- - If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are - already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end - field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to - binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also - set the axis's `tickMinStep - `__ property. + type : enum('single') + Determines the default event processing and data query for the selection. Vega-Lite + currently supports three selection types: - **Default value:** ``false`` - **See also:** `bin `__ - documentation. - field : :class:`Field` - **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. + * ``single`` -- to select a single discrete data value on ``click``. + * ``multi`` -- to select multiple discrete data value; the first value is selected + on ``click`` and additional values toggled on shift- ``click``. + * ``interval`` -- to select a continuous range of data values on ``drag``. + bind : anyOf(:class:`Binding`, 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 also:** `field `__ + **See also:** `bind `__ documentation. + clear : anyOf(:class:`EventStream`, boolean) + Clears the selection, emptying it of all values. Can be an + `EventStream `__ or ``false`` to + disable. - **Notes:** - 1) 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 - `__. - 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : :class:`TimeUnit` - Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal - field. - or `a temporal field that gets casted as ordinal - `__. + **Default value:** ``dblclick``. - **Default value:** ``undefined`` (None) + **See also:** `clear `__ + documentation. + 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(:class:`SingleDefUnitChannel`) + An array of encoding channels. The corresponding data field values + must match for a data tuple to fall within the selection. - **See also:** `timeUnit `__ + **See also:** `encodings `__ documentation. - title : anyOf(string, None) - A title for the field. If ``null``, the title will be removed. + fields : List(:class:`FieldName`) + An array of field names whose values must match for a data tuple to + fall within the selection. - **Default value:** derived from the field's name and transformation function ( - ``aggregate``, ``bin`` and ``timeUnit`` ). 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. + **See also:** `fields `__ + documentation. + init : :class:`SelectionInitMapping` + Initialize the selection with a mapping between `projected channels or field names + `__ and initial values. - **Notes** : + **See also:** `init `__ + documentation. + 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. - 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 - `__. + **See also:** `nearest `__ + documentation. + on : :class:`EventStream` + A `Vega event stream `__ (object or + selector) that triggers the selection. + For interval selections, the event stream must specify a `start and end + `__. + resolve : :class:`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. - 2) If both field definition's ``title`` and axis, header, or legend ``title`` are - defined, axis/header/legend title will be used. + **See also:** `resolve + `__ documentation. """ - _schema = {'$ref': '#/definitions/SecondaryFieldDef'} + _schema = {'$ref': '#/definitions/SingleSelection'} _rootschema = Root._schema - def __init__(self, aggregate=Undefined, bin=Undefined, field=Undefined, timeUnit=Undefined, - title=Undefined, **kwds): - super(SecondaryFieldDef, self).__init__(aggregate=aggregate, bin=bin, field=field, - timeUnit=timeUnit, title=title, **kwds) + def __init__(self, type=Undefined, bind=Undefined, clear=Undefined, empty=Undefined, + encodings=Undefined, fields=Undefined, init=Undefined, nearest=Undefined, on=Undefined, + resolve=Undefined, **kwds): + super(SingleSelection, self).__init__(type=type, bind=bind, clear=clear, empty=empty, + encodings=encodings, fields=fields, init=init, + nearest=nearest, on=on, resolve=resolve, **kwds) -class SelectionConfig(VegaLiteSchema): - """SelectionConfig schema wrapper +class SingleSelectionConfig(VegaLiteSchema): + """SingleSelectionConfig schema wrapper Mapping(required=[]) Attributes ---------- - interval : :class:`IntervalSelectionConfig` - The default definition for an `interval - `__ selection. All - properties and transformations - for an interval selection definition (except ``type`` ) may be specified here. + bind : anyOf(:class:`Binding`, 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. - For instance, setting ``interval`` to ``{"translate": false}`` disables the ability - to move - interval selections by default. - multi : :class:`MultiSelectionConfig` - The default definition for a `multi - `__ selection. All - properties and transformations - for a multi selection definition (except ``type`` ) may be specified here. + **See also:** `bind `__ + documentation. + clear : anyOf(:class:`EventStream`, boolean) + Clears the selection, emptying it of all values. Can be an + `EventStream `__ or ``false`` to + disable. - For instance, setting ``multi`` to ``{"toggle": "event.altKey"}`` adds additional - values to - multi selections when clicking with the alt-key pressed by default. - single : :class:`SingleSelectionConfig` - The default definition for a `single - `__ selection. All - properties and transformations - for a single selection definition (except ``type`` ) may be specified here. + **Default value:** ``dblclick``. - For instance, setting ``single`` to ``{"on": "dblclick"}`` populates single - selections on double-click by default. - """ - _schema = {'$ref': '#/definitions/SelectionConfig'} - _rootschema = Root._schema + **See also:** `clear `__ + documentation. + 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(:class:`SingleDefUnitChannel`) + An array of encoding channels. The corresponding data field values + must match for a data tuple to fall within the selection. - def __init__(self, interval=Undefined, multi=Undefined, single=Undefined, **kwds): - super(SelectionConfig, self).__init__(interval=interval, multi=multi, single=single, **kwds) + **See also:** `encodings `__ + documentation. + fields : List(:class:`FieldName`) + An array of field names whose values must match for a data tuple to + fall within the selection. + **See also:** `fields `__ + documentation. + init : :class:`SelectionInitMapping` + Initialize the selection with a mapping between `projected channels or field names + `__ and initial values. -class SelectionDef(VegaLiteSchema): - """SelectionDef schema wrapper + **See also:** `init `__ + documentation. + 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. - anyOf(:class:`SingleSelection`, :class:`MultiSelection`, :class:`IntervalSelection`) + **See also:** `nearest `__ + documentation. + on : :class:`EventStream` + A `Vega event stream `__ (object or + selector) that triggers the selection. + For interval selections, the event stream must specify a `start and end + `__. + resolve : :class:`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. + + **See also:** `resolve + `__ documentation. """ - _schema = {'$ref': '#/definitions/SelectionDef'} + _schema = {'$ref': '#/definitions/SingleSelectionConfig'} _rootschema = Root._schema - def __init__(self, *args, **kwds): - super(SelectionDef, self).__init__(*args, **kwds) + def __init__(self, bind=Undefined, clear=Undefined, empty=Undefined, encodings=Undefined, + fields=Undefined, init=Undefined, nearest=Undefined, on=Undefined, resolve=Undefined, + **kwds): + super(SingleSelectionConfig, self).__init__(bind=bind, clear=clear, empty=empty, + encodings=encodings, fields=fields, init=init, + nearest=nearest, on=on, resolve=resolve, **kwds) -class SelectionDomain(VegaLiteSchema): - """SelectionDomain schema wrapper +class Sort(VegaLiteSchema): + """Sort schema wrapper - anyOf(Mapping(required=[selection]), Mapping(required=[selection])) + anyOf(:class:`SortArray`, :class:`SortOrder`, :class:`EncodingSortField`, + :class:`SortByEncoding`, None) """ - _schema = {'$ref': '#/definitions/SelectionDomain'} + _schema = {'$ref': '#/definitions/Sort'} _rootschema = Root._schema def __init__(self, *args, **kwds): - super(SelectionDomain, self).__init__(*args, **kwds) + super(Sort, self).__init__(*args, **kwds) -class SelectionInit(VegaLiteSchema): - """SelectionInit schema wrapper +class EncodingSortField(Sort): + """EncodingSortField schema wrapper + + Mapping(required=[]) + A sort definition for sorting a discrete scale in an encoding field definition. + + Attributes + ---------- + + field : :class:`Field` + The data `field `__ to sort by. + + **Default value:** If unspecified, defaults to the field specified in the outer data + reference. + op : :class:`AggregateOp` + An `aggregate operation + `__ to perform on the + field prior to sorting (e.g., ``"count"``, ``"mean"`` and ``"median"`` ). + An aggregation is required when there are multiple values of the sort field for each + encoded data field. + 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 + `__. - anyOf(boolean, float, string, :class:`DateTime`) + **Default value:** ``"sum"`` for stacked plots. Otherwise, ``"mean"``. + order : anyOf(:class:`SortOrder`, None) + The sort order. One of ``"ascending"`` (default), ``"descending"``, or ``null`` (no + not sort). """ - _schema = {'$ref': '#/definitions/SelectionInit'} + _schema = {'$ref': '#/definitions/EncodingSortField'} _rootschema = Root._schema - def __init__(self, *args, **kwds): - super(SelectionInit, self).__init__(*args, **kwds) + def __init__(self, field=Undefined, op=Undefined, order=Undefined, **kwds): + super(EncodingSortField, self).__init__(field=field, op=op, order=order, **kwds) -class SelectionInitInterval(VegaLiteSchema): - """SelectionInitInterval schema wrapper +class SortArray(Sort): + """SortArray schema wrapper - anyOf(List([boolean, boolean]), List([float, float]), List([string, string]), - List([:class:`DateTime`, :class:`DateTime`])) + anyOf(List(float), List(string), List(boolean), List(:class:`DateTime`)) """ - _schema = {'$ref': '#/definitions/SelectionInitInterval'} + _schema = {'$ref': '#/definitions/SortArray'} _rootschema = Root._schema def __init__(self, *args, **kwds): - super(SelectionInitInterval, self).__init__(*args, **kwds) - - -class SelectionInitIntervalMapping(VegaLiteSchema): - """SelectionInitIntervalMapping schema wrapper + super(SortArray, self).__init__(*args, **kwds) - Mapping(required=[]) - """ - _schema = {'$ref': '#/definitions/SelectionInitIntervalMapping'} - _rootschema = Root._schema - def __init__(self, **kwds): - super(SelectionInitIntervalMapping, self).__init__(**kwds) +class SortByEncoding(Sort): + """SortByEncoding schema wrapper + Mapping(required=[encoding]) -class SelectionInitMapping(VegaLiteSchema): - """SelectionInitMapping schema wrapper + Attributes + ---------- - Mapping(required=[]) + encoding : :class:`SingleDefUnitChannel` + The `encoding channel + `__ to sort by (e.g., + ``"x"``, ``"y"`` ) + order : anyOf(:class:`SortOrder`, None) + The sort order. One of ``"ascending"`` (default), ``"descending"``, or ``null`` (no + not sort). """ - _schema = {'$ref': '#/definitions/SelectionInitMapping'} + _schema = {'$ref': '#/definitions/SortByEncoding'} _rootschema = Root._schema - def __init__(self, **kwds): - super(SelectionInitMapping, self).__init__(**kwds) + def __init__(self, encoding=Undefined, order=Undefined, **kwds): + super(SortByEncoding, self).__init__(encoding=encoding, order=order, **kwds) -class SelectionPredicate(VegaLiteSchema): - """SelectionPredicate schema wrapper +class SortField(VegaLiteSchema): + """SortField schema wrapper - Mapping(required=[selection]) + Mapping(required=[field]) + A sort definition for transform Attributes ---------- - selection : :class:`SelectionOperand` - Filter using a selection name. + field : :class:`FieldName` + The name of the field to sort. + order : anyOf(:class:`SortOrder`, None) + Whether to sort the field in ascending or descending order. One of ``"ascending"`` + (default), ``"descending"``, or ``null`` (no not sort). """ - _schema = {'$ref': '#/definitions/SelectionPredicate'} + _schema = {'$ref': '#/definitions/SortField'} _rootschema = Root._schema - def __init__(self, selection=Undefined, **kwds): - super(SelectionPredicate, self).__init__(selection=selection, **kwds) + def __init__(self, field=Undefined, order=Undefined, **kwds): + super(SortField, self).__init__(field=field, order=order, **kwds) -class SelectionResolution(VegaLiteSchema): - """SelectionResolution schema wrapper +class SortOrder(Sort): + """SortOrder schema wrapper - enum('global', 'union', 'intersect') + enum('ascending', 'descending') """ - _schema = {'$ref': '#/definitions/SelectionResolution'} + _schema = {'$ref': '#/definitions/SortOrder'} _rootschema = Root._schema def __init__(self, *args): - super(SelectionResolution, self).__init__(*args) - - -class SequenceGenerator(VegaLiteSchema): - """SequenceGenerator schema wrapper + super(SortOrder, self).__init__(*args) - Mapping(required=[sequence]) - Attributes - ---------- +class Spec(VegaLiteSchema): + """Spec schema wrapper - sequence : :class:`SequenceParams` - Generate a sequence of numbers. - name : string - Provide a placeholder name and bind data at runtime. + anyOf(:class:`FacetedUnitSpec`, :class:`LayerSpec`, :class:`FacetSpec`, :class:`RepeatSpec`, + :class:`ConcatSpec`, :class:`VConcatSpec`, :class:`HConcatSpec`) + Any specification in Vega-Lite. """ - _schema = {'$ref': '#/definitions/SequenceGenerator'} + _schema = {'$ref': '#/definitions/Spec'} _rootschema = Root._schema - def __init__(self, sequence=Undefined, name=Undefined, **kwds): - super(SequenceGenerator, self).__init__(sequence=sequence, name=name, **kwds) + def __init__(self, *args, **kwds): + super(Spec, self).__init__(*args, **kwds) -class SequenceParams(VegaLiteSchema): - """SequenceParams schema wrapper +class ConcatSpec(Spec): + """ConcatSpec schema wrapper - Mapping(required=[start, stop]) + Mapping(required=[concat]) + Base interface for a generalized concatenation specification. Attributes ---------- - start : float - The starting value of the sequence (inclusive). - stop : float - The ending value of the sequence (exclusive). - step : float - The step value between sequence entries. - - **Default value:** ``1`` - as : :class:`FieldName` - The name of the generated sequence field. - - **Default value:** ``"data"`` - """ - _schema = {'$ref': '#/definitions/SequenceParams'} - _rootschema = Root._schema + concat : List(:class:`Spec`) + A list of views to be concatenated. + align : anyOf(:class:`LayoutAlign`, :class:`RowColLayoutAlign`) + The alignment to apply to grid rows and columns. + The supported string values are ``"all"``, ``"each"``, and ``"none"``. - def __init__(self, start=Undefined, stop=Undefined, step=Undefined, **kwds): - super(SequenceParams, self).__init__(start=start, stop=stop, step=step, **kwds) + * 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. -class ShapeFieldDefWithCondition(VegaLiteSchema): - """ShapeFieldDefWithCondition schema wrapper + Alternatively, an object value of the form ``{"row": string, "column": string}`` can + be used to supply different alignments for rows and columns. - Mapping(required=[type]) - A FieldDef with Condition :raw-html:`` + **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) or ``flush``. - Attributes - ---------- - type : :class:`TypeForShape` - The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, - ``"ordinal"``, or ``"nominal"`` ). - It can also be a ``"geojson"`` type for encoding `'geoshape' - `__. + * If set to ``full``, the entire calculated bounds (including axes, title, and + legend) will be used. + * If set to ``flush``, 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. - **Note:** + **Default value:** ``"full"`` + center : anyOf(boolean, :class:`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. - * Data values for a temporal field can be either a date-time string (e.g., - ``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a - timestamp number (e.g., ``1552199579097`` ). - * Data ``type`` describes the semantics of the data rather than the primitive data - types ( ``number``, ``string``, etc.). The same primitive data type can have - different types of measurement. For example, numeric data can represent - quantitative, ordinal, or nominal data. - * When using with `bin `__, the - ``type`` property can be either ``"quantitative"`` (for using a linear bin scale) - or `"ordinal" (for using an ordinal bin scale) - `__. - * When using with `timeUnit - `__, the ``type`` property - can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using - an ordinal scale) `__. - * When using with `aggregate - `__, the ``type`` property - refers to the post-aggregation data type. For example, we can calculate count - ``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct", - "field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output - is ``"quantitative"``. - * Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have - ``type`` as they have exactly the same type as their primary channels (e.g., - ``x``, ``y`` ). + **Default value:** ``false`` + columns : float + The number of columns to include in the view composition layout. - **See also:** `type `__ - documentation. - aggregate : :class:`Aggregate` - Aggregation function for the field - (e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ). + **Default value** : ``undefined`` -- An infinite number of columns (a single row) + will be assumed. This is equivalent to + ``hconcat`` (for ``concat`` ) and to using the ``column`` channel (for ``facet`` and + ``repeat`` ). - **Default value:** ``undefined`` (None) + **Note** : - **See also:** `aggregate `__ - documentation. - bin : anyOf(boolean, :class:`BinParams`, None) - A flag for binning a ``quantitative`` field, `an object defining binning parameters - `__, or indicating that the - data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite ( - ``"binned"`` ). + 1) This property is only for: - If ``true``, default `binning parameters - `__ will be applied. + * the general (wrappable) ``concat`` operator (not ``hconcat`` / ``vconcat`` ) + * the ``facet`` and ``repeat`` operator with one field/repetition definition + (without row/column nesting) - If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are - already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end - field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to - binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also - set the axis's `tickMinStep - `__ property. + 2) Setting the ``columns`` to ``1`` is equivalent to ``vconcat`` (for ``concat`` ) + and to using the ``row`` channel (for ``facet`` and ``repeat`` ). + data : anyOf(:class:`Data`, None) + An object describing the data source. Set to ``null`` to ignore the parent's data + source. If no data is set, it is derived from the parent. + description : string + Description of this mark for commenting purpose. + name : string + Name of the visualization for later reference. + resolve : :class:`Resolve` + Scale, axis, and legend resolutions for view composition specifications. + spacing : anyOf(float, :class:`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:** ``false`` + **Default value** : Depends on ``"spacing"`` property of `the view composition + configuration `__ ( + ``20`` by default) + title : anyOf(string, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`Transform`) + An array of data transformations such as filter and new field calculation. + """ + _schema = {'$ref': '#/definitions/ConcatSpec'} + _rootschema = Root._schema - **See also:** `bin `__ - documentation. - condition : anyOf(:class:`ConditionalStringValueDef`, - List(:class:`ConditionalStringValueDef`)) - One or more value definition(s) with `a selection or a test predicate - `__. + def __init__(self, concat=Undefined, align=Undefined, bounds=Undefined, center=Undefined, + columns=Undefined, data=Undefined, description=Undefined, name=Undefined, + resolve=Undefined, spacing=Undefined, title=Undefined, transform=Undefined, **kwds): + super(ConcatSpec, self).__init__(concat=concat, align=align, bounds=bounds, center=center, + columns=columns, data=data, description=description, name=name, + resolve=resolve, spacing=spacing, title=title, + transform=transform, **kwds) - **Note:** A field definition's ``condition`` property can only contain `conditional - value definitions `__ - since Vega-Lite only allows at most one encoded field per encoding channel. - field : :class:`Field` - **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. - **See also:** `field `__ - documentation. +class FacetSpec(Spec): + """FacetSpec schema wrapper - **Notes:** - 1) 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 - `__. - 2) ``field`` is not required if ``aggregate`` is ``count``. - legend : anyOf(:class:`Legend`, None) - An object defining properties of the legend. - If ``null``, the legend for the encoding channel will be removed. + Mapping(required=[facet, spec]) + Base interface for a facet specification. - **Default value:** If undefined, default `legend properties - `__ are applied. + Attributes + ---------- - **See also:** `legend `__ - documentation. - scale : anyOf(:class:`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. + facet : anyOf(:class:`FacetFieldDef`, :class:`FacetMapping`) + Definition for how to facet the data. One of: + 1) `a field definition for faceting the plot by one field + `__ + 2) `An object that maps row and column channels to their field definitions + `__ + spec : anyOf(:class:`LayerSpec`, :class:`FacetedUnitSpec`) + A specification of the view that gets faceted. + align : anyOf(:class:`LayoutAlign`, :class:`RowColLayoutAlign`) + The alignment to apply to grid rows and columns. + The supported string values are ``"all"``, ``"each"``, and ``"none"``. - If ``null``, the scale will be `disabled and the data value will be directly encoded - `__. - **Default value:** If undefined, default `scale properties - `__ are applied. + * 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. - **See also:** `scale `__ - documentation. - sort : :class:`Sort` - Sort order for the encoded field. + Alternatively, an object value of the form ``{"row": string, "column": string}`` can + be used to supply different alignments for rows and columns. - For continuous fields (quantitative or temporal), ``sort`` can be either - ``"ascending"`` or ``"descending"``. + **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) or ``flush``. - For discrete fields, ``sort`` can be one of the following: + * If set to ``full``, the entire calculated bounds (including axes, title, and + legend) will be used. + * If set to ``flush``, 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. - * ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in - Javascript. - * `A sort-by-encoding definition - `__ for sorting - by another encoding channel. (This type of sort definition is not available for - ``row`` and ``column`` channels.) - * `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:** ``"full"`` + center : anyOf(boolean, :class:`RowColboolean`) + Boolean flag indicating if subviews should be centered relative to their respective + rows or columns. - **Default value:** ``"ascending"`` + An object value of the form ``{"row": boolean, "column": boolean}`` can be used to + supply different centering values for rows and columns. - **Note:** ``null`` is not supported for ``row`` and ``column``. + **Default value:** ``false`` + columns : float + The number of columns to include in the view composition layout. - **See also:** `sort `__ - documentation. - timeUnit : :class:`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`` -- An infinite number of columns (a single row) + will be assumed. This is equivalent to + ``hconcat`` (for ``concat`` ) and to using the ``column`` channel (for ``facet`` and + ``repeat`` ). - **Default value:** ``undefined`` (None) + **Note** : - **See also:** `timeUnit `__ - documentation. - title : anyOf(string, None) - A title for the field. If ``null``, the title will be removed. + 1) This property is only for: - **Default value:** derived from the field's name and transformation function ( - ``aggregate``, ``bin`` and ``timeUnit`` ). 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** : + * the general (wrappable) ``concat`` operator (not ``hconcat`` / ``vconcat`` ) + * the ``facet`` and ``repeat`` operator with one field/repetition definition + (without row/column nesting) - 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) Setting the ``columns`` to ``1`` is equivalent to ``vconcat`` (for ``concat`` ) + and to using the ``row`` channel (for ``facet`` and ``repeat`` ). + data : anyOf(:class:`Data`, None) + An object describing the data source. Set to ``null`` to ignore the parent's data + source. If no data is set, it is derived from the parent. + description : string + Description of this mark for commenting purpose. + name : string + Name of the visualization for later reference. + resolve : :class:`Resolve` + Scale, axis, and legend resolutions for view composition specifications. + spacing : anyOf(float, :class:`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. - 2) If both field definition's ``title`` and axis, header, or legend ``title`` are - defined, axis/header/legend title will be used. + **Default value** : Depends on ``"spacing"`` property of `the view composition + configuration `__ ( + ``20`` by default) + title : anyOf(string, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`Transform`) + An array of data transformations such as filter and new field calculation. """ - _schema = {'$ref': '#/definitions/ShapeFieldDefWithCondition'} + _schema = {'$ref': '#/definitions/FacetSpec'} _rootschema = Root._schema - def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, - field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, - title=Undefined, **kwds): - super(ShapeFieldDefWithCondition, self).__init__(type=type, aggregate=aggregate, bin=bin, - condition=condition, field=field, - legend=legend, scale=scale, sort=sort, - timeUnit=timeUnit, title=title, **kwds) + def __init__(self, facet=Undefined, spec=Undefined, align=Undefined, bounds=Undefined, + center=Undefined, columns=Undefined, data=Undefined, description=Undefined, + name=Undefined, resolve=Undefined, spacing=Undefined, title=Undefined, + transform=Undefined, **kwds): + super(FacetSpec, self).__init__(facet=facet, spec=spec, align=align, bounds=bounds, + center=center, columns=columns, data=data, + description=description, name=name, resolve=resolve, + spacing=spacing, title=title, transform=transform, **kwds) -class ShapeValueDefWithCondition(VegaLiteSchema): - """ShapeValueDefWithCondition schema wrapper +class FacetedUnitSpec(Spec): + """FacetedUnitSpec schema wrapper - Mapping(required=[]) - A ValueDef with Condition where either the condition or the value are - optional. + Mapping(required=[mark]) + Unit spec that can have a composite mark and row or column channels (shorthand for a facet + spec). Attributes ---------- - condition : anyOf(:class:`ConditionalMarkPropFieldDefTypeForShape`, - :class:`ConditionalStringValueDef`, List(:class:`ConditionalStringValueDef`)) - A field definition or one or more value definition(s) with a selection predicate. - value : anyOf(string, None) - A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values - between ``0`` to ``1`` for opacity). - """ - _schema = {'$ref': '#/definitions/ShapeValueDefWithCondition'} - _rootschema = Root._schema - - def __init__(self, condition=Undefined, value=Undefined, **kwds): - super(ShapeValueDefWithCondition, self).__init__(condition=condition, value=value, **kwds) + mark : :class:`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 `__. + align : anyOf(:class:`LayoutAlign`, :class:`RowColLayoutAlign`) + The alignment to apply to grid rows and columns. + The supported string values are ``"all"``, ``"each"``, and ``"none"``. -class SignalRef(VegaLiteSchema): - """SignalRef schema wrapper + * 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. - Mapping(required=[signal]) + Alternatively, an object value of the form ``{"row": string, "column": string}`` can + be used to supply different alignments for rows and columns. - Attributes - ---------- + **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) or ``flush``. - signal : string - """ - _schema = {'$ref': '#/definitions/SignalRef'} - _rootschema = Root._schema + * If set to ``full``, the entire calculated bounds (including axes, title, and + legend) will be used. + * If set to ``flush``, 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. - def __init__(self, signal=Undefined, **kwds): - super(SignalRef, self).__init__(signal=signal, **kwds) + **Default value:** ``"full"`` + center : anyOf(boolean, :class:`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. -class SingleDefUnitChannel(VegaLiteSchema): - """SingleDefUnitChannel schema wrapper + **Default value:** ``false`` + columns : float + The number of columns to include in the view composition layout. - enum('x', 'y', 'x2', 'y2', 'longitude', 'latitude', 'longitude2', 'latitude2', 'color', - 'fill', 'stroke', 'opacity', 'fillOpacity', 'strokeOpacity', 'strokeWidth', 'size', 'shape', - 'key', 'text', 'tooltip', 'href') - """ - _schema = {'$ref': '#/definitions/SingleDefUnitChannel'} - _rootschema = Root._schema + **Default value** : ``undefined`` -- An infinite number of columns (a single row) + will be assumed. This is equivalent to + ``hconcat`` (for ``concat`` ) and to using the ``column`` channel (for ``facet`` and + ``repeat`` ). - def __init__(self, *args): - super(SingleDefUnitChannel, self).__init__(*args) + **Note** : + 1) This property is only for: -class SingleSelection(VegaLiteSchema): - """SingleSelection schema wrapper - Mapping(required=[type]) + * the general (wrappable) ``concat`` operator (not ``hconcat`` / ``vconcat`` ) + * the ``facet`` and ``repeat`` operator with one field/repetition definition + (without row/column nesting) - Attributes - ---------- + 2) Setting the ``columns`` to ``1`` is equivalent to ``vconcat`` (for ``concat`` ) + and to using the ``row`` channel (for ``facet`` and ``repeat`` ). + data : anyOf(:class:`Data`, None) + An object describing the data source. Set to ``null`` to ignore the parent's data + source. If no data is set, it is derived from the parent. + description : string + Description of this mark for commenting purpose. + encoding : :class:`FacetedEncoding` + A key-value mapping between encoding channels and definition of fields. + height : float + The height of a visualization. - type : enum('single') - Determines the default event processing and data query for the selection. Vega-Lite - currently supports three selection types: + **Default value:** - * ``single`` -- to select a single discrete data value on ``click``. - * ``multi`` -- to select multiple discrete data value; the first value is selected - on ``click`` and additional values toggled on shift- ``click``. - * ``interval`` -- to select a continuous range of data values on ``drag``. - bind : anyOf(:class:`Binding`, 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. + * 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`` is ``null``, the height will be the value of `config.view.height + `__. + * If no field is mapped to ``y`` channel, the ``height`` will be the value of + ``rangeStep``. - **See also:** `bind `__ - documentation. - clear : anyOf(:class:`EventStream`, boolean) - Clears the selection, emptying it of all values. Can be an - `EventStream `__ or ``false`` to - disable. + **Note** : For plots with `row and column channels + `__, this represents the + height of a single view. - **Default value:** ``dblclick``. + **See also:** The documentation for `width and height + `__ contains more examples. + name : string + Name of the visualization for later reference. + projection : :class:`Projection` + An object defining properties of geographic projection, which will be applied to + ``shape`` path for ``"geoshape"`` marks + and to ``latitude`` and ``"longitude"`` channels for other marks. + resolve : :class:`Resolve` + Scale, axis, and legend resolutions for view composition specifications. + selection : Mapping(required=[]) + A key-value mapping between selection names and definitions. + spacing : anyOf(float, :class:`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. - **See also:** `clear `__ - documentation. - 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(:class:`SingleDefUnitChannel`) - An array of encoding channels. The corresponding data field values - must match for a data tuple to fall within the selection. + **Default value** : Depends on ``"spacing"`` property of `the view composition + configuration `__ ( + ``20`` by default) + title : anyOf(string, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`Transform`) + An array of data transformations such as filter and new field calculation. + view : :class:`ViewBackground` + An object defining the view background's fill and stroke. - **See also:** `encodings `__ - documentation. - fields : List(:class:`FieldName`) - An array of field names whose values must match for a data tuple to - fall within the selection. + **Default value:** none (transparent) + width : float + The width of a visualization. - **See also:** `fields `__ - documentation. - init : :class:`SelectionInitMapping` - Initialize the selection with a mapping between `projected channels or field names - `__ and initial values. + **Default value:** This will be determined by the following rules: - **See also:** `init `__ - documentation. - 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 also:** `nearest `__ - documentation. - on : :class:`EventStream` - A `Vega event stream `__ (object or - selector) that triggers the selection. - For interval selections, the event stream must specify a `start and end - `__. - resolve : :class:`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. + * 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`` is ``null``, the width will be the value of `config.view.width + `__. + * If no field is mapped to ``x`` channel, the ``width`` will be the value of + `config.scale.textXRangeStep + `__ for + ``text`` mark and the value of ``rangeStep`` for other marks. - **See also:** `resolve - `__ documentation. + **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. """ - _schema = {'$ref': '#/definitions/SingleSelection'} + _schema = {'$ref': '#/definitions/FacetedUnitSpec'} _rootschema = Root._schema - def __init__(self, type=Undefined, bind=Undefined, clear=Undefined, empty=Undefined, - encodings=Undefined, fields=Undefined, init=Undefined, nearest=Undefined, on=Undefined, - resolve=Undefined, **kwds): - super(SingleSelection, self).__init__(type=type, bind=bind, clear=clear, empty=empty, - encodings=encodings, fields=fields, init=init, - nearest=nearest, on=on, resolve=resolve, **kwds) + def __init__(self, mark=Undefined, align=Undefined, bounds=Undefined, center=Undefined, + columns=Undefined, data=Undefined, description=Undefined, encoding=Undefined, + height=Undefined, name=Undefined, projection=Undefined, resolve=Undefined, + selection=Undefined, spacing=Undefined, title=Undefined, transform=Undefined, + view=Undefined, width=Undefined, **kwds): + super(FacetedUnitSpec, self).__init__(mark=mark, align=align, bounds=bounds, center=center, + columns=columns, data=data, description=description, + encoding=encoding, height=height, name=name, + projection=projection, resolve=resolve, + selection=selection, spacing=spacing, title=title, + transform=transform, view=view, width=width, **kwds) -class SingleSelectionConfig(VegaLiteSchema): - """SingleSelectionConfig schema wrapper +class HConcatSpec(Spec): + """HConcatSpec schema wrapper - Mapping(required=[]) + Mapping(required=[hconcat]) + Base interface for a horizontal concatenation specification. Attributes ---------- - bind : anyOf(:class:`Binding`, 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 also:** `bind `__ - documentation. - clear : anyOf(:class:`EventStream`, boolean) - Clears the selection, emptying it of all values. Can be an - `EventStream `__ or ``false`` to - disable. - - **Default value:** ``dblclick``. - - **See also:** `clear `__ - documentation. - 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(:class:`SingleDefUnitChannel`) - An array of encoding channels. The corresponding data field values - must match for a data tuple to fall within the selection. + hconcat : List(:class:`Spec`) + A list of views to 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) or ``flush``. - **See also:** `encodings `__ - documentation. - fields : List(:class:`FieldName`) - An array of field names whose values must match for a data tuple to - fall within the selection. - **See also:** `fields `__ - documentation. - init : :class:`SelectionInitMapping` - Initialize the selection with a mapping between `projected channels or field names - `__ and initial values. + * If set to ``full``, the entire calculated bounds (including axes, title, and + legend) will be used. + * If set to ``flush``, 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. - **See also:** `init `__ - documentation. - 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. + **Default value:** ``"full"`` + center : boolean + Boolean flag indicating if subviews should be centered relative to their respective + rows or columns. - **See also:** `nearest `__ - documentation. - on : :class:`EventStream` - A `Vega event stream `__ (object or - selector) that triggers the selection. - For interval selections, the event stream must specify a `start and end - `__. - resolve : :class:`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. + **Default value:** ``false`` + data : anyOf(:class:`Data`, None) + An object describing the data source. Set to ``null`` to ignore the parent's data + source. If no data is set, it is derived from the parent. + description : string + Description of this mark for commenting purpose. + name : string + Name of the visualization for later reference. + resolve : :class:`Resolve` + Scale, axis, and legend resolutions for view composition specifications. + spacing : float + The spacing in pixels between sub-views of the concat operator. - **See also:** `resolve - `__ documentation. + **Default value** : ``10`` + title : anyOf(string, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`Transform`) + An array of data transformations such as filter and new field calculation. """ - _schema = {'$ref': '#/definitions/SingleSelectionConfig'} + _schema = {'$ref': '#/definitions/HConcatSpec'} _rootschema = Root._schema - def __init__(self, bind=Undefined, clear=Undefined, empty=Undefined, encodings=Undefined, - fields=Undefined, init=Undefined, nearest=Undefined, on=Undefined, resolve=Undefined, - **kwds): - super(SingleSelectionConfig, self).__init__(bind=bind, clear=clear, empty=empty, - encodings=encodings, fields=fields, init=init, - nearest=nearest, on=on, resolve=resolve, **kwds) + def __init__(self, hconcat=Undefined, bounds=Undefined, center=Undefined, data=Undefined, + description=Undefined, name=Undefined, resolve=Undefined, spacing=Undefined, + title=Undefined, transform=Undefined, **kwds): + super(HConcatSpec, self).__init__(hconcat=hconcat, bounds=bounds, center=center, data=data, + description=description, name=name, resolve=resolve, + spacing=spacing, title=title, transform=transform, **kwds) -class SingleTimeUnit(VegaLiteSchema): - """SingleTimeUnit schema wrapper +class LayerSpec(Spec): + """LayerSpec schema wrapper - anyOf(:class:`LocalSingleTimeUnit`, :class:`UtcSingleTimeUnit`) - """ - _schema = {'$ref': '#/definitions/SingleTimeUnit'} - _rootschema = Root._schema + Mapping(required=[layer]) + A full layered plot specification, which may contains ``encoding`` and ``projection`` + properties that will be applied to underlying unit (single-view) specifications. - def __init__(self, *args, **kwds): - super(SingleTimeUnit, self).__init__(*args, **kwds) + Attributes + ---------- + layer : List(anyOf(:class:`LayerSpec`, :class:`UnitSpec`)) + Layer or single view specifications to be layered. -class Sort(VegaLiteSchema): - """Sort schema wrapper + **Note** : Specifications inside ``layer`` cannot use ``row`` and ``column`` + channels as layering facet specifications is not allowed. Instead, use the `facet + operator `__ and place a layer + inside a facet. + data : anyOf(:class:`Data`, None) + An object describing the data source. Set to ``null`` to ignore the parent's data + source. If no data is set, it is derived from the parent. + description : string + Description of this mark for commenting purpose. + encoding : :class:`Encoding` + A shared key-value mapping between encoding channels and definition of fields in the + underlying layers. + height : float + The height of a visualization. - anyOf(:class:`SortArray`, :class:`SortOrder`, :class:`EncodingSortField`, - :class:`SortByEncoding`, None) - """ - _schema = {'$ref': '#/definitions/Sort'} - _rootschema = Root._schema + **Default value:** - def __init__(self, *args, **kwds): - super(Sort, self).__init__(*args, **kwds) + * 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`` is ``null``, the height will be the value of `config.view.height + `__. + * If no field is mapped to ``y`` channel, the ``height`` will be the value of + ``rangeStep``. -class SortArray(VegaLiteSchema): - """SortArray schema wrapper + **Note** : For plots with `row and column channels + `__, this represents the + height of a single view. - anyOf(List(float), List(string), List(boolean), List(:class:`DateTime`)) - """ - _schema = {'$ref': '#/definitions/SortArray'} - _rootschema = Root._schema + **See also:** The documentation for `width and height + `__ contains more examples. + name : string + Name of the visualization for later reference. + projection : :class:`Projection` + An object defining properties of the geographic projection shared by underlying + layers. + resolve : :class:`Resolve` + Scale, axis, and legend resolutions for view composition specifications. + title : anyOf(string, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`Transform`) + An array of data transformations such as filter and new field calculation. + view : :class:`ViewBackground` + An object defining the view background's fill and stroke. - def __init__(self, *args, **kwds): - super(SortArray, self).__init__(*args, **kwds) + **Default value:** none (transparent) + width : float + The width of a visualization. + **Default value:** This will be determined by the following rules: -class SortByEncoding(VegaLiteSchema): - """SortByEncoding schema wrapper - Mapping(required=[encoding]) + * 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`` is ``null``, the width will be the value of `config.view.width + `__. + * If no field is mapped to ``x`` channel, the ``width`` will be the value of + `config.scale.textXRangeStep + `__ for + ``text`` mark and the value of ``rangeStep`` for other marks. - Attributes - ---------- + **Note:** For plots with `row and column channels + `__, this represents the + width of a single view. - encoding : :class:`SingleDefUnitChannel` - The `encoding channel - `__ to sort by (e.g., - ``"x"``, ``"y"`` ) - order : anyOf(:class:`SortOrder`, None) - The sort order. One of ``"ascending"`` (default), ``"descending"``, or ``null`` (no - not sort). + **See also:** The documentation for `width and height + `__ contains more examples. """ - _schema = {'$ref': '#/definitions/SortByEncoding'} + _schema = {'$ref': '#/definitions/LayerSpec'} _rootschema = Root._schema - def __init__(self, encoding=Undefined, order=Undefined, **kwds): - super(SortByEncoding, self).__init__(encoding=encoding, order=order, **kwds) + def __init__(self, layer=Undefined, data=Undefined, description=Undefined, encoding=Undefined, + height=Undefined, name=Undefined, projection=Undefined, resolve=Undefined, + title=Undefined, transform=Undefined, view=Undefined, width=Undefined, **kwds): + super(LayerSpec, self).__init__(layer=layer, data=data, description=description, + encoding=encoding, height=height, name=name, + projection=projection, resolve=resolve, title=title, + transform=transform, view=view, width=width, **kwds) -class SortField(VegaLiteSchema): - """SortField schema wrapper +class RepeatSpec(Spec): + """RepeatSpec schema wrapper - Mapping(required=[field]) - A sort definition for transform + Mapping(required=[repeat, spec]) + Base interface for a repeat specification. Attributes ---------- - field : :class:`FieldName` - The name of the field to sort. - order : anyOf(:class:`SortOrder`, None) - Whether to sort the field in ascending or descending order. One of ``"ascending"`` - (default), ``"descending"``, or ``null`` (no not sort). - """ - _schema = {'$ref': '#/definitions/SortField'} - _rootschema = Root._schema + repeat : anyOf(List(string), :class:`RepeatMapping`) + Definition for fields to be repeated. One of: + 1) An array of fields to be repeated. If ``"repeat"`` is an array, the field can be + referred using ``{"repeat": "repeat"}`` + 2) An object that mapped ``"row"`` and/or ``"column"`` to the listed of fields to be + repeated along the particular orientations. The objects ``{"repeat": "row"}`` and + ``{"repeat": "column"}`` can be used to refer to the repeated field respectively. + spec : :class:`Spec` + A specification of the view that gets repeated. + align : anyOf(:class:`LayoutAlign`, :class:`RowColLayoutAlign`) + The alignment to apply to grid rows and columns. + The supported string values are ``"all"``, ``"each"``, and ``"none"``. - def __init__(self, field=Undefined, order=Undefined, **kwds): - super(SortField, self).__init__(field=field, order=order, **kwds) + * 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}`` can + be used to supply different alignments for rows and columns. -class SortOrder(VegaLiteSchema): - """SortOrder schema wrapper + **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) or ``flush``. - enum('ascending', 'descending') + + * If set to ``full``, the entire calculated bounds (including axes, title, and + legend) will be used. + * If set to ``flush``, 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, :class:`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`` + columns : float + The number of columns to include in the view composition layout. + + **Default value** : ``undefined`` -- An infinite number of columns (a single row) + will be assumed. This is equivalent to + ``hconcat`` (for ``concat`` ) and to using the ``column`` channel (for ``facet`` and + ``repeat`` ). + + **Note** : + + 1) This property is only for: + + + * the general (wrappable) ``concat`` operator (not ``hconcat`` / ``vconcat`` ) + * the ``facet`` and ``repeat`` operator with one field/repetition definition + (without row/column nesting) + + 2) Setting the ``columns`` to ``1`` is equivalent to ``vconcat`` (for ``concat`` ) + and to using the ``row`` channel (for ``facet`` and ``repeat`` ). + data : anyOf(:class:`Data`, None) + An object describing the data source. Set to ``null`` to ignore the parent's data + source. If no data is set, it is derived from the parent. + description : string + Description of this mark for commenting purpose. + name : string + Name of the visualization for later reference. + resolve : :class:`Resolve` + Scale, axis, and legend resolutions for view composition specifications. + spacing : anyOf(float, :class:`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** : Depends on ``"spacing"`` property of `the view composition + configuration `__ ( + ``20`` by default) + title : anyOf(string, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`Transform`) + An array of data transformations such as filter and new field calculation. """ - _schema = {'$ref': '#/definitions/SortOrder'} + _schema = {'$ref': '#/definitions/RepeatSpec'} _rootschema = Root._schema - def __init__(self, *args): - super(SortOrder, self).__init__(*args) + def __init__(self, repeat=Undefined, spec=Undefined, align=Undefined, bounds=Undefined, + center=Undefined, columns=Undefined, data=Undefined, description=Undefined, + name=Undefined, resolve=Undefined, spacing=Undefined, title=Undefined, + transform=Undefined, **kwds): + super(RepeatSpec, self).__init__(repeat=repeat, spec=spec, align=align, bounds=bounds, + center=center, columns=columns, data=data, + description=description, name=name, resolve=resolve, + spacing=spacing, title=title, transform=transform, **kwds) -class SphereGenerator(VegaLiteSchema): +class SphereGenerator(Generator): """SphereGenerator schema wrapper Mapping(required=[sphere]) @@ -12822,37 +12445,6 @@ def __init__(self, *args): super(StackOffset, self).__init__(*args) -class StackTransform(VegaLiteSchema): - """StackTransform schema wrapper - - Mapping(required=[stack, groupby, as]) - - Attributes - ---------- - - groupby : List(:class:`FieldName`) - The data fields to group by. - stack : :class:`FieldName` - The field which is stacked. - offset : enum('zero', 'center', 'normalize') - Mode for stacking marks. - **Default value:** ``"zero"`` - sort : List(:class:`SortField`) - Field that determines the order of leaves in the stacked charts. - as : anyOf(:class:`FieldName`, List(:class:`FieldName`)) - Output field names. This can be either a string or an array of strings with - two elements denoting the name for the fields for stack start and stack end - respectively. - If a single string(eg."val") is provided, the end field will be "val_end". - """ - _schema = {'$ref': '#/definitions/StackTransform'} - _rootschema = Root._schema - - def __init__(self, groupby=Undefined, stack=Undefined, offset=Undefined, sort=Undefined, **kwds): - super(StackTransform, self).__init__(groupby=groupby, stack=stack, offset=offset, sort=sort, - **kwds) - - class StandardType(VegaLiteSchema): """StandardType schema wrapper @@ -12865,8 +12457,8 @@ def __init__(self, *args): super(StandardType, self).__init__(*args) -class StringFieldDefWithConditionTypeForShape(VegaLiteSchema): - """StringFieldDefWithConditionTypeForShape schema wrapper +class StringFieldDefWithCondition(VegaLiteSchema): + """StringFieldDefWithCondition schema wrapper Mapping(required=[type]) A FieldDef with Condition :raw-html:`` @@ -12874,7 +12466,7 @@ class StringFieldDefWithConditionTypeForShape(VegaLiteSchema): Attributes ---------- - type : :class:`TypeForShape` + type : :class:`StandardType` The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, ``"ordinal"``, or ``"nominal"`` ). It can also be a ``"geojson"`` type for encoding `'geoshape' @@ -13050,22 +12642,20 @@ class StringFieldDefWithConditionTypeForShape(VegaLiteSchema): 2) If both field definition's ``title`` and axis, header, or legend ``title`` are defined, axis/header/legend title will be used. """ - _schema = {'$ref': '#/definitions/StringFieldDefWithCondition'} + _schema = {'$ref': '#/definitions/StringFieldDefWithCondition'} _rootschema = Root._schema def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, **kwds): - super(StringFieldDefWithConditionTypeForShape, self).__init__(type=type, aggregate=aggregate, - bin=bin, condition=condition, - field=field, legend=legend, - scale=scale, sort=sort, - timeUnit=timeUnit, title=title, - **kwds) + super(StringFieldDefWithCondition, self).__init__(type=type, aggregate=aggregate, bin=bin, + condition=condition, field=field, + legend=legend, scale=scale, sort=sort, + timeUnit=timeUnit, title=title, **kwds) -class StringFieldDefWithCondition(VegaLiteSchema): - """StringFieldDefWithCondition schema wrapper +class StringFieldDefWithConditionTypeForShape(VegaLiteSchema): + """StringFieldDefWithConditionTypeForShape schema wrapper Mapping(required=[type]) A FieldDef with Condition :raw-html:`` @@ -13073,7 +12663,7 @@ class StringFieldDefWithCondition(VegaLiteSchema): Attributes ---------- - type : :class:`StandardType` + type : :class:`TypeForShape` The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``, ``"ordinal"``, or ``"nominal"`` ). It can also be a ``"geojson"`` type for encoding `'geoshape' @@ -13249,20 +12839,22 @@ class StringFieldDefWithCondition(VegaLiteSchema): 2) If both field definition's ``title`` and axis, header, or legend ``title`` are defined, axis/header/legend title will be used. """ - _schema = {'$ref': '#/definitions/StringFieldDefWithCondition'} + _schema = {'$ref': '#/definitions/StringFieldDefWithCondition'} _rootschema = Root._schema def __init__(self, type=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined, field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, **kwds): - super(StringFieldDefWithCondition, self).__init__(type=type, aggregate=aggregate, bin=bin, - condition=condition, field=field, - legend=legend, scale=scale, sort=sort, - timeUnit=timeUnit, title=title, **kwds) + super(StringFieldDefWithConditionTypeForShape, self).__init__(type=type, aggregate=aggregate, + bin=bin, condition=condition, + field=field, legend=legend, + scale=scale, sort=sort, + timeUnit=timeUnit, title=title, + **kwds) -class StringValueDefWithConditionTypeForShape(VegaLiteSchema): - """StringValueDefWithConditionTypeForShape schema wrapper +class StringValueDefWithCondition(VegaLiteSchema): + """StringValueDefWithCondition schema wrapper Mapping(required=[]) A ValueDef with Condition where either the condition or the value are @@ -13271,23 +12863,22 @@ class StringValueDefWithConditionTypeForShape(VegaLiteSchema): Attributes ---------- - condition : anyOf(:class:`ConditionalMarkPropFieldDefTypeForShape`, - :class:`ConditionalStringValueDef`, List(:class:`ConditionalStringValueDef`)) + condition : anyOf(:class:`ConditionalMarkPropFieldDef`, :class:`ConditionalStringValueDef`, + List(:class:`ConditionalStringValueDef`)) A field definition or one or more value definition(s) with a selection predicate. value : anyOf(string, None) A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values between ``0`` to ``1`` for opacity). """ - _schema = {'$ref': '#/definitions/StringValueDefWithCondition'} + _schema = {'$ref': '#/definitions/StringValueDefWithCondition'} _rootschema = Root._schema def __init__(self, condition=Undefined, value=Undefined, **kwds): - super(StringValueDefWithConditionTypeForShape, self).__init__(condition=condition, value=value, - **kwds) + super(StringValueDefWithCondition, self).__init__(condition=condition, value=value, **kwds) -class StringValueDefWithCondition(VegaLiteSchema): - """StringValueDefWithCondition schema wrapper +class StringValueDefWithConditionTypeForShape(VegaLiteSchema): + """StringValueDefWithConditionTypeForShape schema wrapper Mapping(required=[]) A ValueDef with Condition where either the condition or the value are @@ -13296,18 +12887,19 @@ class StringValueDefWithCondition(VegaLiteSchema): Attributes ---------- - condition : anyOf(:class:`ConditionalMarkPropFieldDef`, :class:`ConditionalStringValueDef`, - List(:class:`ConditionalStringValueDef`)) + condition : anyOf(:class:`ConditionalMarkPropFieldDefTypeForShape`, + :class:`ConditionalStringValueDef`, List(:class:`ConditionalStringValueDef`)) A field definition or one or more value definition(s) with a selection predicate. value : anyOf(string, None) A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values between ``0`` to ``1`` for opacity). """ - _schema = {'$ref': '#/definitions/StringValueDefWithCondition'} + _schema = {'$ref': '#/definitions/StringValueDefWithCondition'} _rootschema = Root._schema def __init__(self, condition=Undefined, value=Undefined, **kwds): - super(StringValueDefWithCondition, self).__init__(condition=condition, value=value, **kwds) + super(StringValueDefWithConditionTypeForShape, self).__init__(condition=condition, value=value, + **kwds) class StrokeCap(VegaLiteSchema): @@ -13370,6 +12962,18 @@ def __init__(self, *args, **kwds): super(TextBaseline, self).__init__(*args, **kwds) +class Baseline(TextBaseline): + """Baseline schema wrapper + + enum('top', 'middle', 'bottom') + """ + _schema = {'$ref': '#/definitions/Baseline'} + _rootschema = Root._schema + + def __init__(self, *args): + super(Baseline, self).__init__(*args) + + class TextConfig(VegaLiteSchema): """TextConfig schema wrapper @@ -14259,26 +13863,56 @@ def __init__(self, *args, **kwds): super(TimeUnit, self).__init__(*args, **kwds) -class TimeUnitTransform(VegaLiteSchema): - """TimeUnitTransform schema wrapper +class MultiTimeUnit(TimeUnit): + """MultiTimeUnit schema wrapper - Mapping(required=[timeUnit, field, as]) + anyOf(:class:`LocalMultiTimeUnit`, :class:`UtcMultiTimeUnit`) + """ + _schema = {'$ref': '#/definitions/MultiTimeUnit'} + _rootschema = Root._schema - Attributes - ---------- + def __init__(self, *args, **kwds): + super(MultiTimeUnit, self).__init__(*args, **kwds) - field : :class:`FieldName` - The data field to apply time unit. - timeUnit : :class:`TimeUnit` - The timeUnit. - as : :class:`FieldName` - The output field to write the timeUnit value. + +class LocalMultiTimeUnit(MultiTimeUnit): + """LocalMultiTimeUnit schema wrapper + + enum('yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', + 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'quartermonth', + 'monthdate', 'monthdatehours', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', + 'secondsmilliseconds') """ - _schema = {'$ref': '#/definitions/TimeUnitTransform'} + _schema = {'$ref': '#/definitions/LocalMultiTimeUnit'} _rootschema = Root._schema - def __init__(self, field=Undefined, timeUnit=Undefined, **kwds): - super(TimeUnitTransform, self).__init__(field=field, timeUnit=timeUnit, **kwds) + def __init__(self, *args): + super(LocalMultiTimeUnit, self).__init__(*args) + + +class SingleTimeUnit(TimeUnit): + """SingleTimeUnit schema wrapper + + anyOf(:class:`LocalSingleTimeUnit`, :class:`UtcSingleTimeUnit`) + """ + _schema = {'$ref': '#/definitions/SingleTimeUnit'} + _rootschema = Root._schema + + def __init__(self, *args, **kwds): + super(SingleTimeUnit, self).__init__(*args, **kwds) + + +class LocalSingleTimeUnit(SingleTimeUnit): + """LocalSingleTimeUnit schema wrapper + + enum('year', 'quarter', 'month', 'day', 'date', 'hours', 'minutes', 'seconds', + 'milliseconds') + """ + _schema = {'$ref': '#/definitions/LocalSingleTimeUnit'} + _rootschema = Root._schema + + def __init__(self, *args): + super(LocalSingleTimeUnit, self).__init__(*args) class TitleAnchor(VegaLiteSchema): @@ -14468,34 +14102,203 @@ def __init__(self, text=Undefined, align=Undefined, anchor=Undefined, angle=Unde style=style, zindex=zindex, **kwds) -class TooltipContent(VegaLiteSchema): - """TooltipContent schema wrapper +class TooltipContent(VegaLiteSchema): + """TooltipContent schema wrapper + + Mapping(required=[content]) + + Attributes + ---------- + + content : enum('encoding', 'data') + + """ + _schema = {'$ref': '#/definitions/TooltipContent'} + _rootschema = Root._schema + + def __init__(self, content=Undefined, **kwds): + super(TooltipContent, self).__init__(content=content, **kwds) + + +class TopLevelSpec(VegaLiteSchema): + """TopLevelSpec schema wrapper + + anyOf(:class:`TopLevelUnitSpec`, :class:`TopLevelFacetSpec`, :class:`TopLevelLayerSpec`, + :class:`TopLevelRepeatSpec`, :class:`TopLevelConcatSpec`, :class:`TopLevelVConcatSpec`, + :class:`TopLevelHConcatSpec`) + A Vega-Lite top-level specification. + This is the root class for all Vega-Lite specifications. + (The json schema is generated from this type.) + """ + _schema = {'$ref': '#/definitions/TopLevelSpec'} + _rootschema = Root._schema + + def __init__(self, *args, **kwds): + super(TopLevelSpec, self).__init__(*args, **kwds) + + +class TopLevelConcatSpec(TopLevelSpec): + """TopLevelConcatSpec schema wrapper + + Mapping(required=[concat]) + + Attributes + ---------- + + concat : List(:class:`Spec`) + A list of views to be concatenated. + align : anyOf(:class:`LayoutAlign`, :class:`RowColLayoutAlign`) + 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}`` can + be used to supply different alignments for rows and columns. + + **Default value:** ``"all"``. + autosize : anyOf(:class:`AutosizeType`, :class:`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 the entire view. + + **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) or ``flush``. + + + * If set to ``full``, the entire calculated bounds (including axes, title, and + legend) will be used. + * If set to ``flush``, 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, :class:`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`` + columns : float + The number of columns to include in the view composition layout. + + **Default value** : ``undefined`` -- An infinite number of columns (a single row) + will be assumed. This is equivalent to + ``hconcat`` (for ``concat`` ) and to using the ``column`` channel (for ``facet`` and + ``repeat`` ). + + **Note** : + + 1) This property is only for: - Mapping(required=[content]) - Attributes - ---------- + * the general (wrappable) ``concat`` operator (not ``hconcat`` / ``vconcat`` ) + * the ``facet`` and ``repeat`` operator with one field/repetition definition + (without row/column nesting) - content : enum('encoding', 'data') + 2) Setting the ``columns`` to ``1`` is equivalent to ``vconcat`` (for ``concat`` ) + and to using the ``row`` channel (for ``facet`` and ``repeat`` ). + config : :class:`Config` + Vega-Lite configuration object. This property can only be defined at the top-level + of a specification. + data : anyOf(:class:`Data`, None) + An object describing the data source. Set to ``null`` to ignore the parent's data + source. If no data is set, it is derived from the parent. + datasets : :class:`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 : :class:`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 : :class:`Resolve` + Scale, axis, and legend resolutions for view composition specifications. + spacing : anyOf(float, :class:`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** : Depends on ``"spacing"`` property of `the view composition + configuration `__ ( + ``20`` by default) + title : anyOf(string, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`Transform`) + An array of data transformations such as filter and new field calculation. + usermeta : Mapping(required=[]) + Optional metadata that will be passed to Vega. + This object is completely ignored by Vega and Vega-Lite and can be used for custom + metadata. + $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/v3.json``. Setting the ``$schema`` + property allows automatic validation and autocomplete in editors that support JSON + schema. """ - _schema = {'$ref': '#/definitions/TooltipContent'} + _schema = {'$ref': '#/definitions/TopLevelConcatSpec'} _rootschema = Root._schema - def __init__(self, content=Undefined, **kwds): - super(TooltipContent, self).__init__(content=content, **kwds) + def __init__(self, concat=Undefined, align=Undefined, autosize=Undefined, background=Undefined, + bounds=Undefined, center=Undefined, columns=Undefined, config=Undefined, + data=Undefined, datasets=Undefined, description=Undefined, name=Undefined, + padding=Undefined, resolve=Undefined, spacing=Undefined, title=Undefined, + transform=Undefined, usermeta=Undefined, **kwds): + super(TopLevelConcatSpec, self).__init__(concat=concat, align=align, autosize=autosize, + background=background, bounds=bounds, center=center, + columns=columns, config=config, data=data, + datasets=datasets, description=description, name=name, + padding=padding, resolve=resolve, spacing=spacing, + title=title, transform=transform, usermeta=usermeta, + **kwds) -class TopLevelConcatSpec(VegaLiteSchema): - """TopLevelConcatSpec schema wrapper +class TopLevelFacetSpec(TopLevelSpec): + """TopLevelFacetSpec schema wrapper - Mapping(required=[concat]) + Mapping(required=[data, facet, spec]) Attributes ---------- - concat : List(:class:`Spec`) - A list of views to be concatenated. + data : anyOf(:class:`Data`, None) + An object describing the data source. Set to ``null`` to ignore the parent's data + source. If no data is set, it is derived from the parent. + facet : anyOf(:class:`FacetFieldDef`, :class:`FacetMapping`) + Definition for how to facet the data. One of: + 1) `a field definition for faceting the plot by one field + `__ + 2) `An object that maps row and column channels to their field definitions + `__ + spec : anyOf(:class:`LayerSpec`, :class:`FacetedUnitSpec`) + A specification of the view that gets faceted. align : anyOf(:class:`LayoutAlign`, :class:`RowColLayoutAlign`) The alignment to apply to grid rows and columns. The supported string values are ``"all"``, ``"each"``, and ``"none"``. @@ -14568,9 +14371,6 @@ class TopLevelConcatSpec(VegaLiteSchema): config : :class:`Config` Vega-Lite configuration object. This property can only be defined at the top-level of a specification. - data : anyOf(:class:`Data`, None) - An object describing the data source. Set to ``null`` to ignore the parent's data - source. If no data is set, it is derived from the parent. datasets : :class:`Datasets` A global data store for named datasets. This is a mapping from names to inline datasets. @@ -14612,24 +14412,24 @@ class TopLevelConcatSpec(VegaLiteSchema): property allows automatic validation and autocomplete in editors that support JSON schema. """ - _schema = {'$ref': '#/definitions/TopLevelConcatSpec'} + _schema = {'$ref': '#/definitions/TopLevelFacetSpec'} _rootschema = Root._schema - def __init__(self, concat=Undefined, align=Undefined, autosize=Undefined, background=Undefined, - bounds=Undefined, center=Undefined, columns=Undefined, config=Undefined, - data=Undefined, datasets=Undefined, description=Undefined, name=Undefined, - padding=Undefined, resolve=Undefined, spacing=Undefined, title=Undefined, - transform=Undefined, usermeta=Undefined, **kwds): - super(TopLevelConcatSpec, self).__init__(concat=concat, align=align, autosize=autosize, - background=background, bounds=bounds, center=center, - columns=columns, config=config, data=data, - datasets=datasets, description=description, name=name, - padding=padding, resolve=resolve, spacing=spacing, - title=title, transform=transform, usermeta=usermeta, - **kwds) + def __init__(self, data=Undefined, facet=Undefined, spec=Undefined, align=Undefined, + autosize=Undefined, background=Undefined, bounds=Undefined, center=Undefined, + columns=Undefined, config=Undefined, datasets=Undefined, description=Undefined, + name=Undefined, padding=Undefined, resolve=Undefined, spacing=Undefined, + title=Undefined, transform=Undefined, usermeta=Undefined, **kwds): + super(TopLevelFacetSpec, self).__init__(data=data, facet=facet, spec=spec, align=align, + autosize=autosize, background=background, bounds=bounds, + center=center, columns=columns, config=config, + datasets=datasets, description=description, name=name, + padding=padding, resolve=resolve, spacing=spacing, + title=title, transform=transform, usermeta=usermeta, + **kwds) -class TopLevelHConcatSpec(VegaLiteSchema): +class TopLevelHConcatSpec(TopLevelSpec): """TopLevelHConcatSpec schema wrapper Mapping(required=[hconcat]) @@ -14727,7 +14527,159 @@ def __init__(self, hconcat=Undefined, autosize=Undefined, background=Undefined, transform=transform, usermeta=usermeta, **kwds) -class TopLevelRepeatSpec(VegaLiteSchema): +class TopLevelLayerSpec(TopLevelSpec): + """TopLevelLayerSpec schema wrapper + + Mapping(required=[layer]) + + Attributes + ---------- + + layer : List(anyOf(:class:`LayerSpec`, :class:`UnitSpec`)) + Layer or single view specifications to be layered. + + **Note** : Specifications inside ``layer`` cannot use ``row`` and ``column`` + channels as layering facet specifications is not allowed. Instead, use the `facet + operator `__ and place a layer + inside a facet. + autosize : anyOf(:class:`AutosizeType`, :class:`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 the entire view. + + **Default value:** none (transparent) + config : :class:`Config` + Vega-Lite configuration object. This property can only be defined at the top-level + of a specification. + data : anyOf(:class:`Data`, None) + An object describing the data source. Set to ``null`` to ignore the parent's data + source. If no data is set, it is derived from the parent. + datasets : :class:`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 : :class:`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`` is ``null``, the height will be the value of `config.view.height + `__. + * If no field is mapped to ``y`` channel, the ``height`` will be the value of + ``rangeStep``. + + **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. + name : string + Name of the visualization for later reference. + padding : :class:`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 : :class:`Projection` + An object defining properties of the geographic projection shared by underlying + layers. + resolve : :class:`Resolve` + Scale, axis, and legend resolutions for view composition specifications. + title : anyOf(string, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`Transform`) + An array of data transformations such as filter and new field calculation. + usermeta : Mapping(required=[]) + Optional metadata that will be passed to Vega. + This object is completely ignored by Vega and Vega-Lite and can be used for custom + metadata. + view : :class:`ViewBackground` + An object defining the view background's fill and stroke. + + **Default value:** none (transparent) + 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`` is ``null``, the width will be the value of `config.view.width + `__. + * If no field is mapped to ``x`` channel, the ``width`` will be the value of + `config.scale.textXRangeStep + `__ for + ``text`` mark and the value of ``rangeStep`` 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. + $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/v3.json``. Setting the ``$schema`` + property allows automatic validation and autocomplete in editors that support JSON + schema. + """ + _schema = {'$ref': '#/definitions/TopLevelLayerSpec'} + _rootschema = Root._schema + + def __init__(self, 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, usermeta=Undefined, + view=Undefined, width=Undefined, **kwds): + super(TopLevelLayerSpec, self).__init__(layer=layer, autosize=autosize, background=background, + config=config, data=data, datasets=datasets, + description=description, encoding=encoding, + height=height, name=name, padding=padding, + projection=projection, resolve=resolve, title=title, + transform=transform, usermeta=usermeta, view=view, + width=width, **kwds) + + +class TopLevelRepeatSpec(TopLevelSpec): """TopLevelRepeatSpec schema wrapper Mapping(required=[repeat, spec]) @@ -14877,16 +14829,39 @@ def __init__(self, repeat=Undefined, spec=Undefined, align=Undefined, autosize=U transform=transform, usermeta=usermeta, **kwds) -class TopLevelVConcatSpec(VegaLiteSchema): - """TopLevelVConcatSpec schema wrapper +class TopLevelUnitSpec(TopLevelSpec): + """TopLevelUnitSpec schema wrapper - Mapping(required=[vconcat]) + Mapping(required=[data, mark]) Attributes ---------- - vconcat : List(:class:`Spec`) - A list of views to be concatenated and put into a column. + data : anyOf(:class:`Data`, None) + An object describing the data source. Set to ``null`` to ignore the parent's data + source. If no data is set, it is derived from the parent. + mark : :class:`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 `__. + align : anyOf(:class:`LayoutAlign`, :class:`RowColLayoutAlign`) + 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}`` can + be used to supply different alignments for rows and columns. + + **Default value:** ``"all"``. autosize : anyOf(:class:`AutosizeType`, :class:`AutoSizeParams`) Sets how the visualization size should be determined. If a string, should be one of ``"pad"``, ``"fit"`` or ``"none"``. @@ -14912,103 +14887,36 @@ class TopLevelVConcatSpec(VegaLiteSchema): sub-plots without axes or legends into a uniform grid structure. **Default value:** ``"full"`` - center : boolean + center : anyOf(boolean, :class:`RowColboolean`) Boolean flag indicating if subviews should be centered relative to their respective rows or columns. - **Default value:** ``false`` - config : :class:`Config` - Vega-Lite configuration object. This property can only be defined at the top-level - of a specification. - data : anyOf(:class:`Data`, None) - An object describing the data source. Set to ``null`` to ignore the parent's data - source. If no data is set, it is derived from the parent. - datasets : :class:`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 : :class:`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 : :class:`Resolve` - Scale, axis, and legend resolutions for view composition specifications. - spacing : float - The spacing in pixels between sub-views of the concat operator. - - **Default value** : ``10`` - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`Transform`) - An array of data transformations such as filter and new field calculation. - usermeta : Mapping(required=[]) - Optional metadata that will be passed to Vega. - This object is completely ignored by Vega and Vega-Lite and can be used for custom - metadata. - $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/v3.json``. Setting the ``$schema`` - property allows automatic validation and autocomplete in editors that support JSON - schema. - """ - _schema = {'$ref': '#/definitions/TopLevelVConcatSpec'} - _rootschema = Root._schema - - def __init__(self, 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, usermeta=Undefined, **kwds): - super(TopLevelVConcatSpec, self).__init__(vconcat=vconcat, autosize=autosize, - background=background, bounds=bounds, center=center, - config=config, data=data, datasets=datasets, - description=description, name=name, padding=padding, - resolve=resolve, spacing=spacing, title=title, - transform=transform, usermeta=usermeta, **kwds) - + An object value of the form ``{"row": boolean, "column": boolean}`` can be used to + supply different centering values for rows and columns. -class TopLevelLayerSpec(VegaLiteSchema): - """TopLevelLayerSpec schema wrapper + **Default value:** ``false`` + columns : float + The number of columns to include in the view composition layout. - Mapping(required=[layer]) + **Default value** : ``undefined`` -- An infinite number of columns (a single row) + will be assumed. This is equivalent to + ``hconcat`` (for ``concat`` ) and to using the ``column`` channel (for ``facet`` and + ``repeat`` ). - Attributes - ---------- + **Note** : - layer : List(anyOf(:class:`LayerSpec`, :class:`UnitSpec`)) - Layer or single view specifications to be layered. + 1) This property is only for: - **Note** : Specifications inside ``layer`` cannot use ``row`` and ``column`` - channels as layering facet specifications is not allowed. Instead, use the `facet - operator `__ and place a layer - inside a facet. - autosize : anyOf(:class:`AutosizeType`, :class:`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 the entire view. + * the general (wrappable) ``concat`` operator (not ``hconcat`` / ``vconcat`` ) + * the ``facet`` and ``repeat`` operator with one field/repetition definition + (without row/column nesting) - **Default value:** none (transparent) + 2) Setting the ``columns`` to ``1`` is equivalent to ``vconcat`` (for ``concat`` ) + and to using the ``row`` channel (for ``facet`` and ``repeat`` ). config : :class:`Config` Vega-Lite configuration object. This property can only be defined at the top-level of a specification. - data : anyOf(:class:`Data`, None) - An object describing the data source. Set to ``null`` to ignore the parent's data - source. If no data is set, it is derived from the parent. datasets : :class:`Datasets` A global data store for named datasets. This is a mapping from names to inline datasets. @@ -15016,9 +14924,8 @@ class TopLevelLayerSpec(VegaLiteSchema): values are ingested as objects with a ``data`` property. description : string Description of this mark for commenting purpose. - encoding : :class:`Encoding` - A shared key-value mapping between encoding channels and definition of fields in the - underlying layers. + encoding : :class:`FacetedEncoding` + A key-value mapping between encoding channels and definition of fields. height : float The height of a visualization. @@ -15057,10 +14964,21 @@ class TopLevelLayerSpec(VegaLiteSchema): **Default value** : ``5`` projection : :class:`Projection` - An object defining properties of the geographic projection shared by underlying - layers. + An object defining properties of geographic projection, which will be applied to + ``shape`` path for ``"geoshape"`` marks + and to ``latitude`` and ``"longitude"`` channels for other marks. resolve : :class:`Resolve` Scale, axis, and legend resolutions for view composition specifications. + selection : Mapping(required=[]) + A key-value mapping between selection names and definitions. + spacing : anyOf(float, :class:`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** : Depends on ``"spacing"`` property of `the view composition + configuration `__ ( + ``20`` by default) title : anyOf(string, :class:`TitleParams`) Title for the plot. transform : List(:class:`Transform`) @@ -15110,59 +15028,36 @@ class TopLevelLayerSpec(VegaLiteSchema): property allows automatic validation and autocomplete in editors that support JSON schema. """ - _schema = {'$ref': '#/definitions/TopLevelLayerSpec'} + _schema = {'$ref': '#/definitions/TopLevelUnitSpec'} _rootschema = Root._schema - def __init__(self, layer=Undefined, autosize=Undefined, background=Undefined, config=Undefined, - data=Undefined, datasets=Undefined, description=Undefined, encoding=Undefined, + def __init__(self, data=Undefined, mark=Undefined, align=Undefined, autosize=Undefined, + background=Undefined, bounds=Undefined, center=Undefined, columns=Undefined, + config=Undefined, datasets=Undefined, description=Undefined, encoding=Undefined, height=Undefined, name=Undefined, padding=Undefined, projection=Undefined, - resolve=Undefined, title=Undefined, transform=Undefined, usermeta=Undefined, - view=Undefined, width=Undefined, **kwds): - super(TopLevelLayerSpec, self).__init__(layer=layer, autosize=autosize, background=background, - config=config, data=data, datasets=datasets, - description=description, encoding=encoding, - height=height, name=name, padding=padding, - projection=projection, resolve=resolve, title=title, - transform=transform, usermeta=usermeta, view=view, - width=width, **kwds) + resolve=Undefined, selection=Undefined, spacing=Undefined, title=Undefined, + transform=Undefined, usermeta=Undefined, view=Undefined, width=Undefined, **kwds): + super(TopLevelUnitSpec, self).__init__(data=data, mark=mark, align=align, autosize=autosize, + background=background, bounds=bounds, center=center, + columns=columns, config=config, datasets=datasets, + description=description, encoding=encoding, + height=height, name=name, padding=padding, + projection=projection, resolve=resolve, + selection=selection, spacing=spacing, title=title, + transform=transform, usermeta=usermeta, view=view, + width=width, **kwds) -class TopLevelFacetSpec(VegaLiteSchema): - """TopLevelFacetSpec schema wrapper +class TopLevelVConcatSpec(TopLevelSpec): + """TopLevelVConcatSpec schema wrapper - Mapping(required=[data, facet, spec]) + Mapping(required=[vconcat]) Attributes ---------- - data : anyOf(:class:`Data`, None) - An object describing the data source. Set to ``null`` to ignore the parent's data - source. If no data is set, it is derived from the parent. - facet : anyOf(:class:`FacetFieldDef`, :class:`FacetMapping`) - Definition for how to facet the data. One of: - 1) `a field definition for faceting the plot by one field - `__ - 2) `An object that maps row and column channels to their field definitions - `__ - spec : anyOf(:class:`LayerSpec`, :class:`FacetedUnitSpec`) - A specification of the view that gets faceted. - align : anyOf(:class:`LayoutAlign`, :class:`RowColLayoutAlign`) - 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}`` can - be used to supply different alignments for rows and columns. - - **Default value:** ``"all"``. + vconcat : List(:class:`Spec`) + A list of views to be concatenated and put into a column. autosize : anyOf(:class:`AutosizeType`, :class:`AutoSizeParams`) Sets how the visualization size should be determined. If a string, should be one of ``"pad"``, ``"fit"`` or ``"none"``. @@ -15188,36 +15083,17 @@ class TopLevelFacetSpec(VegaLiteSchema): sub-plots without axes or legends into a uniform grid structure. **Default value:** ``"full"`` - center : anyOf(boolean, :class:`RowColboolean`) + center : boolean 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`` - columns : float - The number of columns to include in the view composition layout. - - **Default value** : ``undefined`` -- An infinite number of columns (a single row) - will be assumed. This is equivalent to - ``hconcat`` (for ``concat`` ) and to using the ``column`` channel (for ``facet`` and - ``repeat`` ). - - **Note** : - - 1) This property is only for: - - - * the general (wrappable) ``concat`` operator (not ``hconcat`` / ``vconcat`` ) - * the ``facet`` and ``repeat`` operator with one field/repetition definition - (without row/column nesting) - - 2) Setting the ``columns`` to ``1`` is equivalent to ``vconcat`` (for ``concat`` ) - and to using the ``row`` channel (for ``facet`` and ``repeat`` ). + **Default value:** ``false`` config : :class:`Config` Vega-Lite configuration object. This property can only be defined at the top-level of a specification. + data : anyOf(:class:`Data`, None) + An object describing the data source. Set to ``null`` to ignore the parent's data + source. If no data is set, it is derived from the parent. datasets : :class:`Datasets` A global data store for named datasets. This is a mapping from names to inline datasets. @@ -15236,14 +15112,10 @@ class TopLevelFacetSpec(VegaLiteSchema): **Default value** : ``5`` resolve : :class:`Resolve` Scale, axis, and legend resolutions for view composition specifications. - spacing : anyOf(float, :class:`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. + spacing : float + The spacing in pixels between sub-views of the concat operator. - **Default value** : Depends on ``"spacing"`` property of `the view composition - configuration `__ ( - ``20`` by default) + **Default value** : ``10`` title : anyOf(string, :class:`TitleParams`) Title for the plot. transform : List(:class:`Transform`) @@ -15259,326 +15131,417 @@ class TopLevelFacetSpec(VegaLiteSchema): property allows automatic validation and autocomplete in editors that support JSON schema. """ - _schema = {'$ref': '#/definitions/TopLevelFacetSpec'} + _schema = {'$ref': '#/definitions/TopLevelVConcatSpec'} _rootschema = Root._schema - def __init__(self, data=Undefined, facet=Undefined, spec=Undefined, align=Undefined, - autosize=Undefined, background=Undefined, bounds=Undefined, center=Undefined, - columns=Undefined, config=Undefined, datasets=Undefined, description=Undefined, - name=Undefined, padding=Undefined, resolve=Undefined, spacing=Undefined, - title=Undefined, transform=Undefined, usermeta=Undefined, **kwds): - super(TopLevelFacetSpec, self).__init__(data=data, facet=facet, spec=spec, align=align, - autosize=autosize, background=background, bounds=bounds, - center=center, columns=columns, config=config, - datasets=datasets, description=description, name=name, - padding=padding, resolve=resolve, spacing=spacing, - title=title, transform=transform, usermeta=usermeta, - **kwds) + def __init__(self, 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, usermeta=Undefined, **kwds): + super(TopLevelVConcatSpec, self).__init__(vconcat=vconcat, autosize=autosize, + background=background, bounds=bounds, center=center, + config=config, data=data, datasets=datasets, + description=description, name=name, padding=padding, + resolve=resolve, spacing=spacing, title=title, + transform=transform, usermeta=usermeta, **kwds) -class TopLevelSpec(VegaLiteSchema): - """TopLevelSpec schema wrapper +class TopoDataFormat(DataFormat): + """TopoDataFormat schema wrapper - anyOf(:class:`TopLevelUnitSpec`, :class:`TopLevelFacetSpec`, :class:`TopLevelLayerSpec`, - :class:`TopLevelRepeatSpec`, :class:`TopLevelConcatSpec`, :class:`TopLevelVConcatSpec`, - :class:`TopLevelHConcatSpec`) - A Vega-Lite top-level specification. - This is the root class for all Vega-Lite specifications. - (The json schema is generated from this type.) + 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 the ``feature`` 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(:class:`Parse`, None) + If set to ``null``, 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 the ``modified_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"``. + + **Default value:** The default format type is determined by the extension of the + file URL. + If no extension is detected, ``"json"`` will be used by default. """ - _schema = {'$ref': '#/definitions/TopLevelSpec'} + _schema = {'$ref': '#/definitions/TopoDataFormat'} + _rootschema = Root._schema + + def __init__(self, feature=Undefined, mesh=Undefined, parse=Undefined, type=Undefined, **kwds): + super(TopoDataFormat, self).__init__(feature=feature, mesh=mesh, parse=parse, type=type, **kwds) + + +class Transform(VegaLiteSchema): + """Transform schema wrapper + + anyOf(:class:`AggregateTransform`, :class:`BinTransform`, :class:`CalculateTransform`, + :class:`FilterTransform`, :class:`FlattenTransform`, :class:`FoldTransform`, + :class:`ImputeTransform`, :class:`JoinAggregateTransform`, :class:`LookupTransform`, + :class:`TimeUnitTransform`, :class:`SampleTransform`, :class:`StackTransform`, + :class:`WindowTransform`) + """ + _schema = {'$ref': '#/definitions/Transform'} _rootschema = Root._schema def __init__(self, *args, **kwds): - super(TopLevelSpec, self).__init__(*args, **kwds) + super(Transform, self).__init__(*args, **kwds) -class TopLevelUnitSpec(VegaLiteSchema): - """TopLevelUnitSpec schema wrapper +class AggregateTransform(Transform): + """AggregateTransform schema wrapper - Mapping(required=[data, mark]) + Mapping(required=[aggregate]) Attributes ---------- - data : anyOf(:class:`Data`, None) - An object describing the data source. Set to ``null`` to ignore the parent's data - source. If no data is set, it is derived from the parent. - mark : :class:`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 `__. - align : anyOf(:class:`LayoutAlign`, :class:`RowColLayoutAlign`) - The alignment to apply to grid rows and columns. - The supported string values are ``"all"``, ``"each"``, and ``"none"``. + aggregate : List(:class:`AggregatedFieldDef`) + Array of objects that define fields to aggregate. + groupby : List(:class:`FieldName`) + The data fields to group by. If not specified, a single group containing all data + objects will be used. + """ + _schema = {'$ref': '#/definitions/AggregateTransform'} + _rootschema = Root._schema + + def __init__(self, aggregate=Undefined, groupby=Undefined, **kwds): + super(AggregateTransform, self).__init__(aggregate=aggregate, groupby=groupby, **kwds) + + +class BinTransform(Transform): + """BinTransform schema wrapper + + Mapping(required=[bin, field, as]) + + Attributes + ---------- + + bin : anyOf(enum(True), :class:`BinParams`) + An object indicating bin properties, or simply ``true`` for using default bin + parameters. + field : :class:`FieldName` + The data field to bin. + as : anyOf(:class:`FieldName`, List(:class:`FieldName`)) + The output fields at which to write the start and end bin values. + """ + _schema = {'$ref': '#/definitions/BinTransform'} + _rootschema = Root._schema + + def __init__(self, bin=Undefined, field=Undefined, **kwds): + super(BinTransform, self).__init__(bin=bin, field=field, **kwds) + + +class CalculateTransform(Transform): + """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 : :class:`FieldName` + The field for storing the computed formula value. + """ + _schema = {'$ref': '#/definitions/CalculateTransform'} + _rootschema = Root._schema + + def __init__(self, calculate=Undefined, **kwds): + super(CalculateTransform, self).__init__(calculate=calculate, **kwds) + + +class FilterTransform(Transform): + """FilterTransform schema wrapper + + Mapping(required=[filter]) + + Attributes + ---------- + + filter : :class:`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 object + + 2) one of the field predicates: `equal + `__, + `lt `__, + `lte `__, + `gt `__, + `gte `__, + `range `__, + `oneOf `__, + or `valid `__, + + 3) a `selection predicate + `__ + + 4) a logical operand that combines (1), (2), or (3). + """ + _schema = {'$ref': '#/definitions/FilterTransform'} + _rootschema = Root._schema + + def __init__(self, filter=Undefined, **kwds): + super(FilterTransform, self).__init__(filter=filter, **kwds) + + +class FlattenTransform(Transform): + """FlattenTransform schema wrapper + + Mapping(required=[flatten]) + + Attributes + ---------- + + flatten : List(:class:`FieldName`) + An array of one or more data fields containing arrays to flatten. + If multiple fields are specified, their array values should have a parallel + structure, ideally with the same length. + If the lengths of parallel arrays do not match, + the longest array will be used with ``null`` values added for missing entries. + as : List(:class:`FieldName`) + The output field names for extracted array values. + + **Default value:** The field name of the corresponding array field + """ + _schema = {'$ref': '#/definitions/FlattenTransform'} + _rootschema = Root._schema + + def __init__(self, flatten=Undefined, **kwds): + super(FlattenTransform, self).__init__(flatten=flatten, **kwds) + + +class FoldTransform(Transform): + """FoldTransform schema wrapper + + Mapping(required=[fold]) + + Attributes + ---------- + + fold : List(:class:`FieldName`) + An array of data fields indicating the properties to fold. + as : List([:class:`FieldName`, :class:`FieldName`]) + The output field names for the key and value properties produced by the fold + transform. + **Default value:** ``["key", "value"]`` + """ + _schema = {'$ref': '#/definitions/FoldTransform'} + _rootschema = Root._schema + def __init__(self, fold=Undefined, **kwds): + super(FoldTransform, self).__init__(fold=fold, **kwds) - * 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}`` can - be used to supply different alignments for rows and columns. +class ImputeTransform(Transform): + """ImputeTransform schema wrapper - **Default value:** ``"all"``. - autosize : anyOf(:class:`AutosizeType`, :class:`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``. + Mapping(required=[impute, key]) - **Default value** : ``pad`` - background : string - CSS color property to use as the background of the entire view. + Attributes + ---------- - **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) or ``flush``. + impute : :class:`FieldName` + The data field for which the missing values should be imputed. + key : :class:`FieldName` + A key field that uniquely identifies data objects within a group. + Missing key values (those occurring in the data but not in the current group) will + be imputed. + frame : List(anyOf(None, float)) + A frame specification as a two-element array used to control the window over which + the specified method is applied. 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. For example, the value ``[-5, + 5]`` indicates that the window should include five objects preceding and five + objects following the current object. + **Default value:** : ``[null, null]`` indicating that the window includes all + objects. + groupby : List(:class:`FieldName`) + An optional array of fields by which to group the values. + Imputation will then be performed on a per-group basis. + keyvals : anyOf(List(Mapping(required=[])), :class:`ImputeSequence`) + Defines the key values that should be considered for imputation. + An array of key values or an object defining a `number sequence + `__. - * If set to ``full``, the entire calculated bounds (including axes, title, and - legend) will be used. - * If set to ``flush``, 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. + If provided, this will be used in addition to the key values observed within the + input data. If not provided, the values will be derived from all unique values of + the ``key`` field. For ``impute`` in ``encoding``, the key field is the x-field if + the y-field is imputed, or vice versa. - **Default value:** ``"full"`` - center : anyOf(boolean, :class:`RowColboolean`) - Boolean flag indicating if subviews should be centered relative to their respective - rows or columns. + If there is no impute grouping, this property *must* be specified. + method : :class:`ImputeMethod` + The imputation method to use for the field value of imputed data objects. + One of ``value``, ``mean``, ``median``, ``max`` or ``min``. - An object value of the form ``{"row": boolean, "column": boolean}`` can be used to - supply different centering values for rows and columns. + **Default value:** ``"value"`` + value : Mapping(required=[]) + The field value to use when the imputation ``method`` is ``"value"``. + """ + _schema = {'$ref': '#/definitions/ImputeTransform'} + _rootschema = Root._schema - **Default value:** ``false`` - columns : float - The number of columns to include in the view composition layout. + def __init__(self, impute=Undefined, key=Undefined, frame=Undefined, groupby=Undefined, + keyvals=Undefined, method=Undefined, value=Undefined, **kwds): + super(ImputeTransform, self).__init__(impute=impute, key=key, frame=frame, groupby=groupby, + keyvals=keyvals, method=method, value=value, **kwds) - **Default value** : ``undefined`` -- An infinite number of columns (a single row) - will be assumed. This is equivalent to - ``hconcat`` (for ``concat`` ) and to using the ``column`` channel (for ``facet`` and - ``repeat`` ). - **Note** : +class JoinAggregateTransform(Transform): + """JoinAggregateTransform schema wrapper - 1) This property is only for: + Mapping(required=[joinaggregate]) + Attributes + ---------- - * the general (wrappable) ``concat`` operator (not ``hconcat`` / ``vconcat`` ) - * the ``facet`` and ``repeat`` operator with one field/repetition definition - (without row/column nesting) + joinaggregate : List(:class:`JoinAggregateFieldDef`) + The definition of the fields in the join aggregate, and what calculations to use. + groupby : List(:class:`FieldName`) + The data fields for partitioning the data objects into separate groups. If + unspecified, all data points will be in a single group. + """ + _schema = {'$ref': '#/definitions/JoinAggregateTransform'} + _rootschema = Root._schema - 2) Setting the ``columns`` to ``1`` is equivalent to ``vconcat`` (for ``concat`` ) - and to using the ``row`` channel (for ``facet`` and ``repeat`` ). - config : :class:`Config` - Vega-Lite configuration object. This property can only be defined at the top-level - of a specification. - datasets : :class:`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 : :class:`FacetedEncoding` - A key-value mapping between encoding channels and definition of fields. - height : float - The height of a visualization. + def __init__(self, joinaggregate=Undefined, groupby=Undefined, **kwds): + super(JoinAggregateTransform, self).__init__(joinaggregate=joinaggregate, groupby=groupby, + **kwds) - **Default value:** +class LookupTransform(Transform): + """LookupTransform schema wrapper - * 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`` is ``null``, the height will be the value of `config.view.height - `__. - * If no field is mapped to ``y`` channel, the ``height`` will be the value of - ``rangeStep``. + Mapping(required=[lookup, from]) - **Note** : For plots with `row and column channels - `__, this represents the - height of a single view. + Attributes + ---------- - **See also:** The documentation for `width and height - `__ contains more examples. - name : string - Name of the visualization for later reference. - padding : :class:`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. + lookup : :class:`FieldName` + Key in primary data source. + default : string + The default value to use if lookup fails. - **Default value** : ``5`` - projection : :class:`Projection` - An object defining properties of geographic projection, which will be applied to - ``shape`` path for ``"geoshape"`` marks - and to ``latitude`` and ``"longitude"`` channels for other marks. - resolve : :class:`Resolve` - Scale, axis, and legend resolutions for view composition specifications. - selection : Mapping(required=[]) - A key-value mapping between selection names and definitions. - spacing : anyOf(float, :class:`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:** ``null`` + as : anyOf(:class:`FieldName`, List(:class:`FieldName`)) + 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 : :class:`LookupData` + Secondary data reference. + """ + _schema = {'$ref': '#/definitions/LookupTransform'} + _rootschema = Root._schema - **Default value** : Depends on ``"spacing"`` property of `the view composition - configuration `__ ( - ``20`` by default) - title : anyOf(string, :class:`TitleParams`) - Title for the plot. - transform : List(:class:`Transform`) - An array of data transformations such as filter and new field calculation. - usermeta : Mapping(required=[]) - Optional metadata that will be passed to Vega. - This object is completely ignored by Vega and Vega-Lite and can be used for custom - metadata. - view : :class:`ViewBackground` - An object defining the view background's fill and stroke. + def __init__(self, lookup=Undefined, default=Undefined, **kwds): + super(LookupTransform, self).__init__(lookup=lookup, default=default, **kwds) - **Default value:** none (transparent) - width : float - The width of a visualization. - **Default value:** This will be determined by the following rules: +class SampleTransform(Transform): + """SampleTransform schema wrapper + Mapping(required=[sample]) - * 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`` is ``null``, the width will be the value of `config.view.width - `__. - * If no field is mapped to ``x`` channel, the ``width`` will be the value of - `config.scale.textXRangeStep - `__ for - ``text`` mark and the value of ``rangeStep`` for other marks. + Attributes + ---------- - **Note:** For plots with `row and column channels - `__, this represents the - width of a single view. + sample : float + The maximum number of data objects to include in the sample. - **See also:** The documentation for `width and height - `__ contains more examples. - $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/v3.json``. Setting the ``$schema`` - property allows automatic validation and autocomplete in editors that support JSON - schema. + **Default value:** ``1000`` """ - _schema = {'$ref': '#/definitions/TopLevelUnitSpec'} + _schema = {'$ref': '#/definitions/SampleTransform'} _rootschema = Root._schema - def __init__(self, data=Undefined, mark=Undefined, align=Undefined, autosize=Undefined, - background=Undefined, bounds=Undefined, center=Undefined, columns=Undefined, - config=Undefined, datasets=Undefined, description=Undefined, encoding=Undefined, - height=Undefined, name=Undefined, padding=Undefined, projection=Undefined, - resolve=Undefined, selection=Undefined, spacing=Undefined, title=Undefined, - transform=Undefined, usermeta=Undefined, view=Undefined, width=Undefined, **kwds): - super(TopLevelUnitSpec, self).__init__(data=data, mark=mark, align=align, autosize=autosize, - background=background, bounds=bounds, center=center, - columns=columns, config=config, datasets=datasets, - description=description, encoding=encoding, - height=height, name=name, padding=padding, - projection=projection, resolve=resolve, - selection=selection, spacing=spacing, title=title, - transform=transform, usermeta=usermeta, view=view, - width=width, **kwds) + def __init__(self, sample=Undefined, **kwds): + super(SampleTransform, self).__init__(sample=sample, **kwds) -class TopoDataFormat(VegaLiteSchema): - """TopoDataFormat schema wrapper +class StackTransform(Transform): + """StackTransform schema wrapper - Mapping(required=[]) + Mapping(required=[stack, groupby, as]) 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 the ``feature`` 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(:class:`Parse`, None) - If set to ``null``, 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 the ``modified_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"``. - - **Default value:** The default format type is determined by the extension of the - file URL. - If no extension is detected, ``"json"`` will be used by default. + groupby : List(:class:`FieldName`) + The data fields to group by. + stack : :class:`FieldName` + The field which is stacked. + offset : enum('zero', 'center', 'normalize') + Mode for stacking marks. + **Default value:** ``"zero"`` + sort : List(:class:`SortField`) + Field that determines the order of leaves in the stacked charts. + as : anyOf(:class:`FieldName`, List(:class:`FieldName`)) + Output field names. This can be either a string or an array of strings with + two elements denoting the name for the fields for stack start and stack end + respectively. + If a single string(eg."val") is provided, the end field will be "val_end". """ - _schema = {'$ref': '#/definitions/TopoDataFormat'} + _schema = {'$ref': '#/definitions/StackTransform'} _rootschema = Root._schema - def __init__(self, feature=Undefined, mesh=Undefined, parse=Undefined, type=Undefined, **kwds): - super(TopoDataFormat, self).__init__(feature=feature, mesh=mesh, parse=parse, type=type, **kwds) + def __init__(self, groupby=Undefined, stack=Undefined, offset=Undefined, sort=Undefined, **kwds): + super(StackTransform, self).__init__(groupby=groupby, stack=stack, offset=offset, sort=sort, + **kwds) -class Transform(VegaLiteSchema): - """Transform schema wrapper +class TimeUnitTransform(Transform): + """TimeUnitTransform schema wrapper - anyOf(:class:`AggregateTransform`, :class:`BinTransform`, :class:`CalculateTransform`, - :class:`FilterTransform`, :class:`FlattenTransform`, :class:`FoldTransform`, - :class:`ImputeTransform`, :class:`JoinAggregateTransform`, :class:`LookupTransform`, - :class:`TimeUnitTransform`, :class:`SampleTransform`, :class:`StackTransform`, - :class:`WindowTransform`) + Mapping(required=[timeUnit, field, as]) + + Attributes + ---------- + + field : :class:`FieldName` + The data field to apply time unit. + timeUnit : :class:`TimeUnit` + The timeUnit. + as : :class:`FieldName` + The output field to write the timeUnit value. """ - _schema = {'$ref': '#/definitions/Transform'} + _schema = {'$ref': '#/definitions/TimeUnitTransform'} _rootschema = Root._schema - def __init__(self, *args, **kwds): - super(Transform, self).__init__(*args, **kwds) + def __init__(self, field=Undefined, timeUnit=Undefined, **kwds): + super(TimeUnitTransform, self).__init__(field=field, timeUnit=timeUnit, **kwds) class TypeForShape(VegaLiteSchema): @@ -15832,7 +15795,7 @@ def __init__(self, mark=Undefined, data=Undefined, description=Undefined, encodi width=width, **kwds) -class UrlData(VegaLiteSchema): +class UrlData(DataSource): """UrlData schema wrapper Mapping(required=[url]) @@ -15855,7 +15818,7 @@ def __init__(self, url=Undefined, format=Undefined, name=Undefined, **kwds): super(UrlData, self).__init__(url=url, format=format, name=name, **kwds) -class UtcMultiTimeUnit(VegaLiteSchema): +class UtcMultiTimeUnit(MultiTimeUnit): """UtcMultiTimeUnit schema wrapper enum('utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', @@ -15871,7 +15834,7 @@ def __init__(self, *args): super(UtcMultiTimeUnit, self).__init__(*args) -class UtcSingleTimeUnit(VegaLiteSchema): +class UtcSingleTimeUnit(SingleTimeUnit): """UtcSingleTimeUnit schema wrapper enum('utcyear', 'utcquarter', 'utcmonth', 'utcday', 'utcdate', 'utchours', 'utcminutes', @@ -15884,80 +15847,77 @@ def __init__(self, *args): super(UtcSingleTimeUnit, self).__init__(*args) -class Value(VegaLiteSchema): - """Value schema wrapper - - anyOf(float, string, boolean, None) - """ - _schema = {'$ref': '#/definitions/Value'} - _rootschema = Root._schema - - def __init__(self, *args): - super(Value, self).__init__(*args) - - -class YValueDef(VegaLiteSchema): - """YValueDef schema wrapper +class VConcatSpec(Spec): + """VConcatSpec schema wrapper - Mapping(required=[value]) - Definition object for a constant value of an encoding channel. + Mapping(required=[vconcat]) + Base interface for a vertical concatenation specification. Attributes ---------- - value : anyOf(float, enum('height')) - A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values - between ``0`` to ``1`` for opacity). - """ - _schema = {'$ref': '#/definitions/YValueDef'} - _rootschema = Root._schema - - def __init__(self, value=Undefined, **kwds): - super(YValueDef, self).__init__(value=value, **kwds) + vconcat : List(:class:`Spec`) + A list of views to 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) or ``flush``. -class XValueDef(VegaLiteSchema): - """XValueDef schema wrapper + * If set to ``full``, the entire calculated bounds (including axes, title, and + legend) will be used. + * If set to ``flush``, 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. - Mapping(required=[value]) - Definition object for a constant value of an encoding channel. + **Default value:** ``"full"`` + center : boolean + Boolean flag indicating if subviews should be centered relative to their respective + rows or columns. - Attributes - ---------- + **Default value:** ``false`` + data : anyOf(:class:`Data`, None) + An object describing the data source. Set to ``null`` to ignore the parent's data + source. If no data is set, it is derived from the parent. + description : string + Description of this mark for commenting purpose. + name : string + Name of the visualization for later reference. + resolve : :class:`Resolve` + Scale, axis, and legend resolutions for view composition specifications. + spacing : float + The spacing in pixels between sub-views of the concat operator. - value : anyOf(float, enum('width')) - A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values - between ``0`` to ``1`` for opacity). + **Default value** : ``10`` + title : anyOf(string, :class:`TitleParams`) + Title for the plot. + transform : List(:class:`Transform`) + An array of data transformations such as filter and new field calculation. """ - _schema = {'$ref': '#/definitions/XValueDef'} + _schema = {'$ref': '#/definitions/VConcatSpec'} _rootschema = Root._schema - def __init__(self, value=Undefined, **kwds): - super(XValueDef, self).__init__(value=value, **kwds) - - -class NumberValueDef(VegaLiteSchema): - """NumberValueDef schema wrapper + def __init__(self, vconcat=Undefined, bounds=Undefined, center=Undefined, data=Undefined, + description=Undefined, name=Undefined, resolve=Undefined, spacing=Undefined, + title=Undefined, transform=Undefined, **kwds): + super(VConcatSpec, self).__init__(vconcat=vconcat, bounds=bounds, center=center, data=data, + description=description, name=name, resolve=resolve, + spacing=spacing, title=title, transform=transform, **kwds) - Mapping(required=[value]) - Definition object for a constant value of an encoding channel. - Attributes - ---------- +class Value(VegaLiteSchema): + """Value schema wrapper - value : float - A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values - between ``0`` to ``1`` for opacity). + anyOf(float, string, boolean, None) """ - _schema = {'$ref': '#/definitions/NumberValueDef'} + _schema = {'$ref': '#/definitions/Value'} _rootschema = Root._schema - def __init__(self, value=Undefined, **kwds): - super(NumberValueDef, self).__init__(value=value, **kwds) + def __init__(self, *args): + super(Value, self).__init__(*args) -class ValueDefWithConditionMarkPropFieldDefstringnull(VegaLiteSchema): - """ValueDefWithConditionMarkPropFieldDefstringnull schema wrapper +class ValueDefWithConditionMarkPropFieldDefTypeForShapestringnull(VegaLiteSchema): + """ValueDefWithConditionMarkPropFieldDefTypeForShapestringnull schema wrapper Mapping(required=[]) A ValueDef with Condition where either the condition or the value are @@ -15966,19 +15926,20 @@ class ValueDefWithConditionMarkPropFieldDefstringnull(VegaLiteSchema): Attributes ---------- - condition : anyOf(:class:`ConditionalMarkPropFieldDef`, :class:`ConditionalStringValueDef`, - List(:class:`ConditionalStringValueDef`)) + condition : anyOf(:class:`ConditionalMarkPropFieldDefTypeForShape`, + :class:`ConditionalStringValueDef`, List(:class:`ConditionalStringValueDef`)) A field definition or one or more value definition(s) with a selection predicate. value : anyOf(string, None) A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values between ``0`` to ``1`` for opacity). """ - _schema = {'$ref': '#/definitions/ValueDefWithCondition'} + _schema = {'$ref': '#/definitions/ValueDefWithCondition,(string|null)>'} _rootschema = Root._schema def __init__(self, condition=Undefined, value=Undefined, **kwds): - super(ValueDefWithConditionMarkPropFieldDefstringnull, self).__init__(condition=condition, - value=value, **kwds) + super(ValueDefWithConditionMarkPropFieldDefTypeForShapestringnull, self).__init__(condition=condition, + value=value, + **kwds) class ValueDefWithConditionMarkPropFieldDefnumber(VegaLiteSchema): @@ -16006,8 +15967,8 @@ def __init__(self, condition=Undefined, value=Undefined, **kwds): value=value, **kwds) -class ValueDefWithConditionMarkPropFieldDefTypeForShapestringnull(VegaLiteSchema): - """ValueDefWithConditionMarkPropFieldDefTypeForShapestringnull schema wrapper +class ValueDefWithConditionMarkPropFieldDefstringnull(VegaLiteSchema): + """ValueDefWithConditionMarkPropFieldDefstringnull schema wrapper Mapping(required=[]) A ValueDef with Condition where either the condition or the value are @@ -16016,20 +15977,19 @@ class ValueDefWithConditionMarkPropFieldDefTypeForShapestringnull(VegaLiteSchema Attributes ---------- - condition : anyOf(:class:`ConditionalMarkPropFieldDefTypeForShape`, - :class:`ConditionalStringValueDef`, List(:class:`ConditionalStringValueDef`)) + condition : anyOf(:class:`ConditionalMarkPropFieldDef`, :class:`ConditionalStringValueDef`, + List(:class:`ConditionalStringValueDef`)) A field definition or one or more value definition(s) with a selection predicate. value : anyOf(string, None) A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values between ``0`` to ``1`` for opacity). """ - _schema = {'$ref': '#/definitions/ValueDefWithCondition,(string|null)>'} + _schema = {'$ref': '#/definitions/ValueDefWithCondition'} _rootschema = Root._schema def __init__(self, condition=Undefined, value=Undefined, **kwds): - super(ValueDefWithConditionMarkPropFieldDefTypeForShapestringnull, self).__init__(condition=condition, - value=value, - **kwds) + super(ValueDefWithConditionMarkPropFieldDefstringnull, self).__init__(condition=condition, + value=value, **kwds) class ValueDefWithConditionTextFieldDefValue(VegaLiteSchema): @@ -16258,7 +16218,7 @@ def __init__(self, *args): super(WindowOnlyOp, self).__init__(*args) -class WindowTransform(VegaLiteSchema): +class WindowTransform(Transform): """WindowTransform schema wrapper Mapping(required=[window]) @@ -16312,3 +16272,43 @@ def __init__(self, window=Undefined, frame=Undefined, groupby=Undefined, ignoreP super(WindowTransform, self).__init__(window=window, frame=frame, groupby=groupby, ignorePeers=ignorePeers, sort=sort, **kwds) + +class XValueDef(VegaLiteSchema): + """XValueDef schema wrapper + + Mapping(required=[value]) + Definition object for a constant value of an encoding channel. + + Attributes + ---------- + + value : anyOf(float, enum('width')) + A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values + between ``0`` to ``1`` for opacity). + """ + _schema = {'$ref': '#/definitions/XValueDef'} + _rootschema = Root._schema + + def __init__(self, value=Undefined, **kwds): + super(XValueDef, self).__init__(value=value, **kwds) + + +class YValueDef(VegaLiteSchema): + """YValueDef schema wrapper + + Mapping(required=[value]) + Definition object for a constant value of an encoding channel. + + Attributes + ---------- + + value : anyOf(float, enum('height')) + A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values + between ``0`` to ``1`` for opacity). + """ + _schema = {'$ref': '#/definitions/YValueDef'} + _rootschema = Root._schema + + def __init__(self, value=Undefined, **kwds): + super(YValueDef, self).__init__(value=value, **kwds) + diff --git a/doc/user_guide/API.rst b/doc/user_guide/API.rst index f634dcc11..a564474a7 100644 --- a/doc/user_guide/API.rst +++ b/doc/user_guide/API.rst @@ -105,6 +105,7 @@ API Functions binding_select concat condition + graticule hconcat layer pipe @@ -113,6 +114,8 @@ API Functions selection_interval selection_multi selection_single + sequence + sphere topo_feature value vconcat diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index f63c9dfdd..de374f287 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -62,7 +62,7 @@ def schema_class(*args, **kwargs): class {basename}(SchemaBase): @classmethod def _default_wrapper_classes(cls): - return {basename}.__subclasses__() + return _subclasses({basename}) """ LOAD_SCHEMA = ''' @@ -223,6 +223,32 @@ def copy_schemapi_util(): dest.writelines(source.readlines()) +def toposort(graph): + """Topological sort of a directed acyclic graph. + + Parameters + ---------- + graph : dict of lists + Mapping of node labels to list of child node labels. + This is assumed to represent a graph with no cycles. + + Returns + ------- + order : list + topological order of input graph. + """ + stack = [] + visited = {} + def visit(nodes): + for node in sorted(nodes, reverse=True): + if not visited.get(node): + visited[node] = True + visit(graph.get(node, [])) + stack.insert(0, node) + visit(graph) + return stack + + def generate_vegalite_schema_wrapper(schema_file): """Generate a schema wrapper at the given path.""" # TODO: generate simple tests for each wrapper @@ -230,21 +256,46 @@ def generate_vegalite_schema_wrapper(schema_file): with open(schema_file, encoding='utf8') as f: rootschema = json.load(f) - contents = [HEADER, - "from altair.utils.schemapi import SchemaBase, Undefined", - LOAD_SCHEMA.format(schemafile='vega-lite-schema.json')] - contents.append(BASE_SCHEMA.format(basename=basename)) - contents.append(schema_class('Root', schema=rootschema, basename=basename, - schemarepr=CodeSnippet('load_schema()'))) + + definitions = {} for name in rootschema['definitions']: defschema = {'$ref': '#/definitions/' + name} defschema_repr = {'$ref': '#/definitions/' + name} + name = get_valid_identifier(name) + definitions[name] = SchemaGenerator( + name, schema=defschema, schemarepr=defschema_repr, + rootschema=rootschema, basename=basename, + rootschemarepr=CodeSnippet("Root._schema"), + ) + + graph = {} + + for name, schema in definitions.items(): + graph[name] = [] + for child in schema.subclasses(): + child = get_valid_identifier(child) + graph[name].append(child) + child = definitions[child] + if child.basename == basename: + child.basename = [name] + else: + child.basename.append(name) + + contents = [HEADER, + "from altair.utils.schemapi import SchemaBase, Undefined, _subclasses", + LOAD_SCHEMA.format(schemafile='vega-lite-schema.json')] + contents.append(BASE_SCHEMA.format(basename=basename)) + contents.append(schema_class('Root', + schema=rootschema, + basename=basename, + schemarepr=CodeSnippet('load_schema()') + ) + ) + + for name in toposort(graph): + contents.append(definitions[name].schema_class()) - contents.append(schema_class(get_valid_identifier(name), - schema=defschema, schemarepr=defschema_repr, - rootschema=rootschema, basename=basename, - rootschemarepr=CodeSnippet("Root._schema"))) contents.append('') # end with newline return '\n'.join(contents) diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index 8ded209d3..5516dcec7 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -65,8 +65,8 @@ class SchemaGenerator(object): The dictionary defining the schema class rootschema : dict (optional) The root schema for the class - basename : string (default: "SchemaBase") - The name of the base class to use in the class definition + basename : string or tuple (default: "SchemaBase") + The name(s) of the base class(es) to use in the class definition schemarepr : CodeSnippet or object, optional An object whose repr will be used in the place of the explicit schema. This can be useful, for example, when the generated code should reference @@ -107,6 +107,11 @@ def __init__(self, classname, schema, rootschema=None, self.nodefault = nodefault self.kwargs = kwargs + def subclasses(self): + """Return a list of subclass names, if any.""" + info = SchemaInfo(self.schema, self.rootschema) + return [child.refname for child in info.anyOf if child.is_reference()] + def schema_class(self): """Generate code for a schema class""" rootschema = self.rootschema if self.rootschema is not None else self.schema @@ -117,9 +122,13 @@ def schema_class(self): rootschemarepr = CodeSnippet('_schema') else: rootschemarepr = rootschema + if isinstance(self.basename, str): + basename = self.basename + else: + basename = ', '.join(self.basename) return self.schema_class_template.format( classname=self.classname, - basename=self.basename, + basename=basename, schema=schemarepr, rootschema=rootschemarepr, docstring=self.docstring(indent=4), diff --git a/tools/schemapi/schemapi.py b/tools/schemapi/schemapi.py index 7d73064cd..048e10130 100644 --- a/tools/schemapi/schemapi.py +++ b/tools/schemapi/schemapi.py @@ -36,6 +36,17 @@ def debug_mode(arg): DEBUG_MODE = original +def _subclasses(cls): + """Breadth-first sequence of classes which inherit from cls.""" + seen = set() + current_set = {cls} + while current_set: + seen |= current_set + current_set = set.union(*(set(cls.__subclasses__()) for cls in current_set)) + for cls in current_set - seen: + yield cls + + def _todict(obj, validate, context): """Convert an object to a dict representation.""" if isinstance(obj, SchemaBase): @@ -333,7 +344,7 @@ def to_json(self, validate=True, ignore=[], context={}, @classmethod def _default_wrapper_classes(cls): """Return the set of classes used within cls.from_dict()""" - return SchemaBase.__subclasses__() + return _subclasses(SchemaBase) @classmethod def from_dict(cls, dct, validate=True, _wrapper_classes=None): From d672ab1f5aa739d46863470ce3cc6abbf99e74b2 Mon Sep 17 00:00:00 2001 From: Jake VanderPlas Date: Fri, 22 Nov 2019 21:48:49 -0800 Subject: [PATCH 2/3] Simplify type checking in api --- altair/vegalite/v2/api.py | 20 +++++--------------- altair/vegalite/v3/api.py | 22 +++++----------------- 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/altair/vegalite/v2/api.py b/altair/vegalite/v2/api.py index c62ec73d8..2be7ee6af 100644 --- a/altair/vegalite/v2/api.py +++ b/altair/vegalite/v2/api.py @@ -92,8 +92,7 @@ def _prepare_data(data, context): data = _consolidate_data(data, context) # if data is still not a recognized type, then return - if not isinstance(data, (dict, core.Data, core.UrlData, - core.InlineData, core.NamedData)): + if not isinstance(data, (dict, core.Data)): warnings.warn("data of type {} not recognized".format(type(data))) return data @@ -329,19 +328,12 @@ def condition(predicate, if_true, if_false, **kwargs): spec: dict or VegaLiteSchema the spec that describes the condition """ - selection_predicates = (core.SelectionNot, core.SelectionOr, - core.SelectionAnd, core.SelectionOperand) - test_predicates = (six.string_types, expr.Expression, core.Predicate, - core.LogicalOperandPredicate, core.LogicalNotPredicate, - core.LogicalOrPredicate, core.LogicalAndPredicate, - core.FieldEqualPredicate, core.FieldOneOfPredicate, - core.FieldRangePredicate, core.FieldLTPredicate, - core.FieldGTPredicate, core.FieldLTEPredicate, - core.FieldGTEPredicate, core.SelectionPredicate) + test_predicates = (six.string_types, expr.Expression, + core.LogicalOperandPredicate) if isinstance(predicate, NamedSelection): condition = {'selection': predicate._get_name()} - elif isinstance(predicate, selection_predicates): + elif isinstance(predicate, core.SelectionOperand): condition = {'selection': predicate} elif isinstance(predicate, test_predicates): condition = {'test': predicate} @@ -872,11 +864,9 @@ def transform_filter(self, filter, **kwargs): alt.FilterTransform : underlying transform object """ - selection_predicates = (core.SelectionNot, core.SelectionOr, - core.SelectionAnd, core.SelectionOperand) if isinstance(filter, NamedSelection): filter = {'selection': filter._get_name()} - elif isinstance(filter, selection_predicates): + elif isinstance(filter, core.SelectionOperand): filter = {'selection': filter} return self._add_transform(core.FilterTransform(filter=filter, **kwargs)) diff --git a/altair/vegalite/v3/api.py b/altair/vegalite/v3/api.py index 6dc875a5d..f551b812d 100644 --- a/altair/vegalite/v3/api.py +++ b/altair/vegalite/v3/api.py @@ -92,10 +92,7 @@ def _prepare_data(data, context): data = _consolidate_data(data, context) # if data is still not a recognized type, then return - if not isinstance(data, (dict, core.Data, core.UrlData, - core.InlineData, core.NamedData, - core.GraticuleGenerator, core.SequenceGenerator, - core.SphereGenerator)): + if not isinstance(data, (dict, core.Data)): warnings.warn("data of type {} not recognized".format(type(data))) return data @@ -294,19 +291,12 @@ def condition(predicate, if_true, if_false, **kwargs): spec: dict or VegaLiteSchema the spec that describes the condition """ - selection_predicates = (core.SelectionNot, core.SelectionOr, - core.SelectionAnd, core.SelectionOperand) - test_predicates = (six.string_types, expr.Expression, core.Predicate, - core.LogicalOperandPredicate, core.LogicalNotPredicate, - core.LogicalOrPredicate, core.LogicalAndPredicate, - core.FieldEqualPredicate, core.FieldOneOfPredicate, - core.FieldRangePredicate, core.FieldLTPredicate, - core.FieldGTPredicate, core.FieldLTEPredicate, - core.FieldGTEPredicate, core.SelectionPredicate) + test_predicates = (six.string_types, expr.Expression, + core.LogicalOperandPredicate) if isinstance(predicate, Selection): condition = {'selection': predicate.name} - elif isinstance(predicate, selection_predicates): + elif isinstance(predicate, core.SelectionOperand): condition = {'selection': predicate} elif isinstance(predicate, test_predicates): condition = {'test': predicate} @@ -971,11 +961,9 @@ def transform_filter(self, filter, **kwargs): alt.FilterTransform : underlying transform object """ - selection_predicates = (core.SelectionNot, core.SelectionOr, - core.SelectionAnd, core.SelectionOperand) if isinstance(filter, Selection): filter = {'selection': filter.name} - elif isinstance(filter, selection_predicates): + elif isinstance(filter, core.SelectionOperand): filter = {'selection': filter} return self._add_transform(core.FilterTransform(filter=filter, **kwargs)) From 015f2f2589bce8f9095ee1a4797debbf8afb99b1 Mon Sep 17 00:00:00 2001 From: Jake VanderPlas Date: Fri, 22 Nov 2019 22:00:17 -0800 Subject: [PATCH 3/3] Fix flake8 errors --- altair/utils/schemapi.py | 6 ++++-- altair/vega/v4/schema/core.py | 2 +- altair/vega/v5/schema/core.py | 2 +- tools/generate_schema_wrapper.py | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/altair/utils/schemapi.py b/altair/utils/schemapi.py index f22d7b416..86b14509a 100644 --- a/altair/utils/schemapi.py +++ b/altair/utils/schemapi.py @@ -41,7 +41,7 @@ def debug_mode(arg): def _subclasses(cls): - """Breadth-first sequence of classes which inherit from cls.""" + """Breadth-first sequence of all classes which inherit from cls.""" seen = set() current_set = {cls} while current_set: @@ -498,7 +498,9 @@ def _passthrough(*args, **kwds): return args[0] if args else kwds if cls is None: - # TODO: do something more than simply selecting the last match? + # If there are multiple matches, we use the last one in the dict. + # Our class dict is constructed breadth-first from top to bottom, + # so the last class that matches is the most specific. matches = self.class_dict[self.hash_schema(schema)] cls = matches[-1] if matches else _passthrough schema = _resolve_references(schema, rootschema) diff --git a/altair/vega/v4/schema/core.py b/altair/vega/v4/schema/core.py index 3eab67a9b..426fb38b9 100644 --- a/altair/vega/v4/schema/core.py +++ b/altair/vega/v4/schema/core.py @@ -3,7 +3,7 @@ # The contents of this file are automatically written by # tools/generate_schema_wrapper.py. Do not modify directly. -from altair.utils.schemapi import SchemaBase, Undefined +from altair.utils.schemapi import SchemaBase, Undefined, _subclasses import pkgutil import json diff --git a/altair/vega/v5/schema/core.py b/altair/vega/v5/schema/core.py index dccbcccc4..fafb0be0d 100644 --- a/altair/vega/v5/schema/core.py +++ b/altair/vega/v5/schema/core.py @@ -3,7 +3,7 @@ # The contents of this file are automatically written by # tools/generate_schema_wrapper.py. Do not modify directly. -from altair.utils.schemapi import SchemaBase, Undefined +from altair.utils.schemapi import SchemaBase, Undefined, _subclasses import pkgutil import json diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index de374f287..2c24700bb 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -308,7 +308,7 @@ def generate_vega_schema_wrapper(schema_file): with open(schema_file, encoding='utf8') as f: rootschema = json.load(f) contents = [HEADER, - "from altair.utils.schemapi import SchemaBase, Undefined", + "from altair.utils.schemapi import SchemaBase, Undefined, _subclasses", LOAD_SCHEMA.format(schemafile='vega-schema.json')] contents.append(BASE_SCHEMA.format(basename=basename)) contents.append(schema_class('Root', schema=rootschema, basename=basename,