altair.Config

class altair.Config(area=Undefined, autosize=Undefined, axis=Undefined, axisBand=Undefined, axisBottom=Undefined, axisDiscrete=Undefined, axisLeft=Undefined, axisPoint=Undefined, axisQuantitative=Undefined, axisRight=Undefined, axisTemporal=Undefined, axisTop=Undefined, axisX=Undefined, axisXBand=Undefined, axisXDiscrete=Undefined, axisXPoint=Undefined, axisXQuantitative=Undefined, axisXTemporal=Undefined, axisY=Undefined, axisYBand=Undefined, axisYDiscrete=Undefined, axisYPoint=Undefined, axisYQuantitative=Undefined, axisYTemporal=Undefined, background=Undefined, bar=Undefined, boxplot=Undefined, circle=Undefined, concat=Undefined, countTitle=Undefined, errorband=Undefined, errorbar=Undefined, facet=Undefined, fieldTitle=Undefined, font=Undefined, geoshape=Undefined, header=Undefined, headerColumn=Undefined, headerFacet=Undefined, headerRow=Undefined, image=Undefined, legend=Undefined, line=Undefined, lineBreak=Undefined, mark=Undefined, numberFormat=Undefined, padding=Undefined, point=Undefined, projection=Undefined, range=Undefined, rect=Undefined, rule=Undefined, scale=Undefined, selection=Undefined, square=Undefined, style=Undefined, text=Undefined, tick=Undefined, timeFormat=Undefined, title=Undefined, trail=Undefined, view=Undefined, **kwds)

Config schema wrapper

Mapping(required=[])

Attributes:
area : AreaConfig

Area-Specific Config

autosize : anyOf(AutosizeType, AutoSizeParams)

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.

Default value : pad

axis : AxisConfig

Axis configuration, which determines default properties for all x and y axes. For a full list of axis configuration options, please see the corresponding section of the axis documentation.

axisBand : AxisConfig

Config for axes with “band” scales.

axisBottom : AxisConfig

Config for x-axis along the bottom edge of the chart.

axisDiscrete : AxisConfig

Config for axes with “point” or “band” scales.

axisLeft : AxisConfig

Config for y-axis along the left edge of the chart.

axisPoint : AxisConfig

Config for axes with “point” scales.

axisQuantitative : AxisConfig

Config for quantitative axes.

axisRight : AxisConfig

Config for y-axis along the right edge of the chart.

axisTemporal : AxisConfig

Config for temporal axes.

axisTop : AxisConfig

Config for x-axis along the top edge of the chart.

axisX : AxisConfig

X-axis specific config.

axisXBand : AxisConfig

Config for x-axes with “band” scales.

axisXDiscrete : AxisConfig

Config for x-axes with “point” or “band” scales.

axisXPoint : AxisConfig

Config for x-axes with “point” scales.

axisXQuantitative : AxisConfig

Config for x-quantitative axes.

axisXTemporal : AxisConfig

Config for x-temporal axes.

axisY : AxisConfig

Y-axis specific config.

axisYBand : AxisConfig

Config for y-axes with “band” scales.

axisYDiscrete : AxisConfig

Config for y-axes with “point” or “band” scales.

axisYPoint : AxisConfig

Config for y-axes with “point” scales.

axisYQuantitative : AxisConfig

Config for y-quantitative axes.

axisYTemporal : AxisConfig

Config for y-temporal axes.

background : Color

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

Default value: "white"

bar : BarConfig

Bar-Specific Config

boxplot : BoxPlotConfig

Box Config

circle : MarkConfig

Circle-Specific Config

concat : CompositionConfig

Default configuration for all concatenation and repeat view composition operators ( concat, hconcat, vconcat, and repeat )

countTitle : string

Default axis and legend title for count fields.

Default value: 'Count of Records.

errorband : ErrorBandConfig

ErrorBand Config

errorbar : ErrorBarConfig

ErrorBar Config

facet : CompositionConfig

Default configuration for the facet view composition operator

fieldTitle : enum(‘verbal’, ‘functional’, ‘plain’)

Defines how Vega-Lite generates title for fields. There are three possible styles:

  • "verbal" (Default) - displays function in a verbal style (e.g., “Sum of field”, “Year-month of date”, “field (binned)”).
  • "function" - displays function using parentheses and capitalized texts (e.g., “SUM(field)”, “YEARMONTH(date)”, “BIN(field)”).
  • "plain" - displays only the field name without functions (e.g., “field”, “date”, “field”).
font : string

Default font for all text marks, titles, and labels.

geoshape : MarkConfig

Geoshape-Specific Config

header : HeaderConfig

Header configuration, which determines default properties for all headers.

For a full list of header configuration options, please see the corresponding section of in the header documentation.

headerColumn : HeaderConfig

Header configuration, which determines default properties for column headers.

For a full list of header configuration options, please see the corresponding section of in the header documentation.

headerFacet : HeaderConfig

Header configuration, which determines default properties for non-row/column facet headers.

For a full list of header configuration options, please see the corresponding section of in the header documentation.

headerRow : HeaderConfig

Header configuration, which determines default properties for row headers.

For a full list of header configuration options, please see the corresponding section of in the header documentation.

image : RectConfig

Image-specific Config

legend : LegendConfig

Legend configuration, which determines default properties for all legends. For a full list of legend configuration options, please see the corresponding section of in the legend documentation.

line : LineConfig

Line-Specific Config

lineBreak : string

A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property provides a global default for text marks, which is overridden by mark or style config settings, and by the lineBreak mark encoding channel. If signal-valued, either string or regular expression (regexp) values are valid.

mark : MarkConfig

Mark Config

numberFormat : string

D3 Number format for guide labels and text marks. For example "s" for SI units. Use D3’s number format pattern.

padding : Padding

The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format {"left": 5, "top": 5, "right": 5, "bottom": 5} to specify padding for each side of the visualization.

Default value : 5

point : MarkConfig

Point-Specific Config

projection : ProjectionConfig

Projection configuration, which determines default properties for all projections. For a full list of projection configuration options, please see the corresponding section of the projection documentation.

range : RangeConfig

An object hash that defines default range arrays or schemes for using with scales. For a full list of scale range configuration options, please see the corresponding section of the scale documentation.

rect : RectConfig

Rect-Specific Config

rule : MarkConfig

Rule-Specific Config

scale : ScaleConfig

Scale configuration determines default properties for all scales. For a full list of scale configuration options, please see the corresponding section of the scale documentation.

selection : SelectionConfig

An object hash for defining default properties for each type of selections.

square : MarkConfig

Square-Specific Config

style : StyleConfigIndex

An object hash that defines key-value mappings to determine default properties for marks with a given style. The keys represent styles names; the values have to be valid mark configuration objects.

text : MarkConfig

Text-Specific Config

tick : TickConfig

Tick-Specific Config

timeFormat : string

Default time format for raw time values (without time units) in text marks, legend labels and header labels.

Default value: "%b %d, %Y" Note: Axes automatically determine the format for each label automatically so this config does not affect axes.

title : TitleConfig

Title configuration, which determines default properties for all titles. For a full list of title configuration options, please see the corresponding section of the title documentation.

trail : LineConfig

Trail-Specific Config

view : ViewConfig

Default properties for single view plots.

__init__(area=Undefined, autosize=Undefined, axis=Undefined, axisBand=Undefined, axisBottom=Undefined, axisDiscrete=Undefined, axisLeft=Undefined, axisPoint=Undefined, axisQuantitative=Undefined, axisRight=Undefined, axisTemporal=Undefined, axisTop=Undefined, axisX=Undefined, axisXBand=Undefined, axisXDiscrete=Undefined, axisXPoint=Undefined, axisXQuantitative=Undefined, axisXTemporal=Undefined, axisY=Undefined, axisYBand=Undefined, axisYDiscrete=Undefined, axisYPoint=Undefined, axisYQuantitative=Undefined, axisYTemporal=Undefined, background=Undefined, bar=Undefined, boxplot=Undefined, circle=Undefined, concat=Undefined, countTitle=Undefined, errorband=Undefined, errorbar=Undefined, facet=Undefined, fieldTitle=Undefined, font=Undefined, geoshape=Undefined, header=Undefined, headerColumn=Undefined, headerFacet=Undefined, headerRow=Undefined, image=Undefined, legend=Undefined, line=Undefined, lineBreak=Undefined, mark=Undefined, numberFormat=Undefined, padding=Undefined, point=Undefined, projection=Undefined, range=Undefined, rect=Undefined, rule=Undefined, scale=Undefined, selection=Undefined, square=Undefined, style=Undefined, text=Undefined, tick=Undefined, timeFormat=Undefined, title=Undefined, trail=Undefined, view=Undefined, **kwds)

Methods

__init__([area, autosize, axis, axisBand, …])
copy([deep, ignore]) Return a copy of the object
from_dict(dct[, validate, _wrapper_classes]) Construct class from a dictionary representation
from_json(json_string[, validate]) Instantiate the object from a valid JSON string
resolve_references([schema]) Resolve references in the context of this object’s schema or root schema.
to_dict([validate, ignore, context]) Return a dictionary representation of the object
to_json([validate, ignore, context, indent, …]) Emit the JSON representation for this object as a string.
validate(instance[, schema]) Validate the instance against the class schema in the context of the rootschema.
validate_property(name, value[, schema]) Validate a property against property schema in the context of the
copy(deep=True, ignore=())

Return a copy of the object

Parameters:
deep : boolean or list, optional

If True (default) then return a deep copy of all dict, list, and SchemaBase objects within the object structure. If False, then only copy the top object. If a list or iterable, then only copy the listed attributes.

ignore : list, optional

A list of keys for which the contents should not be copied, but only stored by reference.

from_dict(dct, validate=True, _wrapper_classes=None)

Construct class from a dictionary representation

Parameters:
dct : dictionary

The dict from which to construct the class

validate : boolean

If True (default), then validate the input against the schema.

_wrapper_classes : list (optional)

The set of SchemaBase classes to use when constructing wrappers of the dict inputs. If not specified, the result of cls._default_wrapper_classes will be used.

Returns:
obj : Schema object

The wrapped schema

Raises:
jsonschema.ValidationError :

if validate=True and dct does not conform to the schema

from_json(json_string, validate=True, **kwargs)

Instantiate the object from a valid JSON string

Parameters:
json_string : string

The string containing a valid JSON chart specification.

validate : boolean

If True (default), then validate the input against the schema.

**kwargs :

Additional keyword arguments are passed to json.loads

Returns:
chart : Chart object

The altair Chart object built from the specification.

resolve_references(schema=None)

Resolve references in the context of this object’s schema or root schema.

to_dict(validate=True, ignore=None, context=None)

Return a dictionary representation of the object

Parameters:
validate : boolean or string

If True (default), then validate the output dictionary against the schema. If “deep” then recursively validate all objects in the spec. This takes much more time, but it results in friendlier tracebacks for large objects.

ignore : list

A list of keys to ignore. This will not passed to child to_dict function calls.

context : dict (optional)

A context dictionary that will be passed to all child to_dict function calls

Returns:
dct : dictionary

The dictionary representation of this object

Raises:
jsonschema.ValidationError :

if validate=True and the dict does not conform to the schema

to_json(validate=True, ignore=[], context={}, indent=2, sort_keys=True, **kwargs)

Emit the JSON representation for this object as a string.

Parameters:
validate : boolean or string

If True (default), then validate the output dictionary against the schema. If “deep” then recursively validate all objects in the spec. This takes much more time, but it results in friendlier tracebacks for large objects.

ignore : list

A list of keys to ignore. This will not passed to child to_dict function calls.

context : dict (optional)

A context dictionary that will be passed to all child to_dict function calls

indent : integer, default 2

the number of spaces of indentation to use

sort_keys : boolean, default True

if True, sort keys in the output

**kwargs

Additional keyword arguments are passed to json.dumps()

Returns:
spec : string

The JSON specification of the chart object.

validate(instance, schema=None)

Validate the instance against the class schema in the context of the rootschema.

validate_property(name, value, schema=None)

Validate a property against property schema in the context of the rootschema