altair.MarkDef#
- class altair.MarkDef(type=Undefined, align=Undefined, angle=Undefined, aria=Undefined, ariaRole=Undefined, ariaRoleDescription=Undefined, aspect=Undefined, bandSize=Undefined, baseline=Undefined, binSpacing=Undefined, blend=Undefined, clip=Undefined, color=Undefined, continuousBandSize=Undefined, cornerRadius=Undefined, cornerRadiusBottomLeft=Undefined, cornerRadiusBottomRight=Undefined, cornerRadiusEnd=Undefined, cornerRadiusTopLeft=Undefined, cornerRadiusTopRight=Undefined, cursor=Undefined, description=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, innerRadius=Undefined, interpolate=Undefined, invalid=Undefined, limit=Undefined, line=Undefined, lineBreak=Undefined, lineHeight=Undefined, opacity=Undefined, order=Undefined, orient=Undefined, outerRadius=Undefined, padAngle=Undefined, point=Undefined, radius=Undefined, radius2=Undefined, radius2Offset=Undefined, radiusOffset=Undefined, shape=Undefined, size=Undefined, smooth=Undefined, stroke=Undefined, strokeCap=Undefined, strokeDash=Undefined, strokeDashOffset=Undefined, strokeJoin=Undefined, strokeMiterLimit=Undefined, strokeOffset=Undefined, strokeOpacity=Undefined, strokeWidth=Undefined, style=Undefined, tension=Undefined, text=Undefined, theta=Undefined, theta2=Undefined, theta2Offset=Undefined, thetaOffset=Undefined, thickness=Undefined, timeUnitBandPosition=Undefined, timeUnitBandSize=Undefined, tooltip=Undefined, url=Undefined, width=Undefined, x=Undefined, x2=Undefined, x2Offset=Undefined, xOffset=Undefined, y=Undefined, y2=Undefined, y2Offset=Undefined, yOffset=Undefined, **kwds)#
MarkDef schema wrapper
Mapping(required=[type])
- Attributes
- type
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"
).- alignanyOf(
Align
,ExprRef
) The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of
"left"
,"right"
,"center"
.Note: Expression reference is not supported for range marks.
- angleanyOf(float,
ExprRef
) - ariaanyOf(boolean,
ExprRef
) - ariaRoleanyOf(string,
ExprRef
) - ariaRoleDescriptionanyOf(string,
ExprRef
) - aspectanyOf(boolean,
ExprRef
) - bandSizefloat
The width of the ticks.
Default value: 3/4 of step (width step for horizontal ticks and height step for vertical ticks).
- baselineanyOf(
TextBaseline
,ExprRef
) For text marks, the vertical text baseline. One of
"alphabetic"
(default),"top"
,"middle"
,"bottom"
,"line-top"
,"line-bottom"
, or an expression reference that provides one of the valid values. The"line-top"
and"line-bottom"
values operate similarly to"top"
and"bottom"
, but are calculated relative to thelineHeight
rather thanfontSize
alone.For range marks, the vertical alignment of the marks. One of
"top"
,"middle"
,"bottom"
.Note: Expression reference is not supported for range marks.
- binSpacingfloat
Offset between bars for binned field. The ideal value for this is either 0 (preferred by statisticians) or 1 (Vega-Lite default, D3 example style).
Default value:
1
- blendanyOf(
Blend
,ExprRef
) - clipboolean
Whether a mark be clipped to the enclosing group’s width and height.
- coloranyOf(
Color
,Gradient
,ExprRef
) Default color.
Default value: ■
"#4682b4"
Note:
This property cannot be used in a style config.
The
fill
andstroke
properties have higher precedence thancolor
and will overridecolor
.
- continuousBandSizefloat
The default size of the bars on continuous scales.
Default value:
5
- cornerRadiusanyOf(float,
ExprRef
) - cornerRadiusBottomLeftanyOf(float,
ExprRef
) - cornerRadiusBottomRightanyOf(float,
ExprRef
) - cornerRadiusEndanyOf(float,
ExprRef
) For vertical bars, top-left and top-right corner radius.
For horizontal bars, top-right and bottom-right corner radius.
- cornerRadiusTopLeftanyOf(float,
ExprRef
) - cornerRadiusTopRightanyOf(float,
ExprRef
) - cursoranyOf(
Cursor
,ExprRef
) - descriptionanyOf(string,
ExprRef
) - diranyOf(
TextDirection
,ExprRef
) - discreteBandSizeanyOf(float,
RelativeBandSize
) The default size of the bars with discrete dimensions. If unspecified, the default size is
step-2
, which provides 2 pixel offset between bars.- dxanyOf(float,
ExprRef
) - dyanyOf(float,
ExprRef
) - ellipsisanyOf(string,
ExprRef
) - fillanyOf(
Color
,Gradient
, None,ExprRef
) Default fill color. This property has higher precedence than
config.color
. Set tonull
to remove fill.Default value: (None)
- fillOpacityanyOf(float,
ExprRef
) - filledboolean
Whether the mark’s color should be used as fill color instead of stroke color.
Default value:
false
for allpoint
,line
, andrule
marks as well asgeoshape
marks for graticule data sources; otherwise,true
.Note: This property cannot be used in a style config.
- fontanyOf(string,
ExprRef
) - fontSizeanyOf(float,
ExprRef
) - fontStyleanyOf(
FontStyle
,ExprRef
) - fontWeightanyOf(
FontWeight
,ExprRef
) - heightanyOf(float,
ExprRef
,RelativeBandSize
) Height of the marks. One of:
A number representing a fixed pixel height.
A relative band size definition. For example,
{band: 0.5}
represents half of the band- hrefanyOf(
URI
,ExprRef
) - innerRadiusanyOf(float,
ExprRef
) The inner radius in pixels of arc marks.
innerRadius
is an alias forradius2
.Default value:
0
- interpolateanyOf(
Interpolate
,ExprRef
) - invalidenum(‘filter’, None)
Defines how Vega-Lite should handle marks for invalid values (
null
andNaN
).If set to
"filter"
(default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).If
null
, all data items are included. In this case, invalid values will be interpreted as zeroes.
- limitanyOf(float,
ExprRef
) - lineanyOf(boolean,
OverlayMarkDef
) A flag for overlaying line on top of area marks, or an object defining the properties of the overlayed lines.
If this value is an empty object (
{}
) ortrue
, lines with default properties will be used.If this value is
false
, no lines would be automatically added to area marks.Default value:
false
.- lineBreakanyOf(string,
ExprRef
) - lineHeightanyOf(float,
ExprRef
) - opacityanyOf(float,
ExprRef
) The overall opacity (value between [0,1]).
Default value:
0.7
for non-aggregate plots withpoint
,tick
,circle
, orsquare
marks or layeredbar
charts and1
otherwise.- orderanyOf(None, boolean)
For line and trail marks, this
order
property can be set tonull
orfalse
to make the lines use the original order in the data sources.- orient
Orientation
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.
- outerRadiusanyOf(float,
ExprRef
) The outer radius in pixels of arc marks.
outerRadius
is an alias forradius
.Default value:
0
- padAngleanyOf(float,
ExprRef
) - pointanyOf(boolean,
OverlayMarkDef
, string) A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points.
If this property is
"transparent"
, transparent points will be used (for enhancing tooltips and selections).If this property is an empty object (
{}
) ortrue
, filled points with default properties will be used.If this property is
false
, no points would be automatically added to line or area marks.Default value:
false
.- radiusanyOf(float,
ExprRef
) For arc mark, the primary (outer) radius in pixels.
For text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the
x
andy
properties.Default value:
min(plot_width, plot_height)/2
- radius2anyOf(float,
ExprRef
) The secondary (inner) radius in pixels of arc marks.
Default value:
0
- radius2OffsetanyOf(float,
ExprRef
) Offset for radius2.
- radiusOffsetanyOf(float,
ExprRef
) Offset for radius.
- shapeanyOf(anyOf(
SymbolShape
, string),ExprRef
) - sizeanyOf(float,
ExprRef
) Default size for marks.
For
point
/circle
/square
, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this 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; width/height’sstep
2
for bar marks with discrete dimensions;5
for bar marks with continuous dimensions;11
for text marks.
- smoothanyOf(boolean,
ExprRef
) - strokeanyOf(
Color
,Gradient
, None,ExprRef
) Default stroke color. This property has higher precedence than
config.color
. Set tonull
to remove stroke.Default value: (None)
- strokeCapanyOf(
StrokeCap
,ExprRef
) - strokeDashanyOf(List(float),
ExprRef
) - strokeDashOffsetanyOf(float,
ExprRef
) - strokeJoinanyOf(
StrokeJoin
,ExprRef
) - strokeMiterLimitanyOf(float,
ExprRef
) - strokeOffsetanyOf(float,
ExprRef
) - strokeOpacityanyOf(float,
ExprRef
) - strokeWidthanyOf(float,
ExprRef
) - styleanyOf(string, List(string))
A string or array of strings indicating the name of custom styles to apply to the mark. A style is a named collection of mark property defaults defined within the style configuration. If style is an array, later styles will override earlier styles. Any mark properties explicitly defined within the
encoding
will override a style default.Default value: The mark’s name. For example, a bar mark will have style
"bar"
by default. Note: Any specified style will augment the default style. For example, a bar mark with"style": "foo"
will receive fromconfig.style.bar
andconfig.style.foo
(the specified style"foo"
has higher precedence).- tensionanyOf(float,
ExprRef
) - textanyOf(
Text
,ExprRef
) - thetaanyOf(float,
ExprRef
) For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)
For text marks, polar coordinate angle in radians.
- theta2anyOf(float,
ExprRef
) The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.
- theta2OffsetanyOf(float,
ExprRef
) Offset for theta2.
- thetaOffsetanyOf(float,
ExprRef
) Offset for theta.
- thicknessfloat
Thickness of the tick mark.
Default value:
1
- timeUnitBandPositionfloat
Default relative band position for a time unit. If set to
0
, the marks will be positioned at the beginning of the time unit band step. If set to0.5
, the marks will be positioned in the middle of the time unit band step.- timeUnitBandSizefloat
Default relative band size for a time unit. If set to
1
, the bandwidth of the marks will be equal to the time unit band step. If set to0.5
, bandwidth of the marks will be half of the time unit band step.- tooltipanyOf(float, string, boolean,
TooltipContent
,ExprRef
, None) The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from.
If
tooltip
istrue
or{"content": "encoding"}
, then all fields fromencoding
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
orfalse
, then no tooltip will be used.
See the tooltip documentation for a detailed discussion about tooltip in Vega-Lite.
Default value:
null
- urlanyOf(
URI
,ExprRef
) - widthanyOf(float,
ExprRef
,RelativeBandSize
) Width of the marks. One of:
A number representing a fixed pixel width.
A relative band size definition. For example,
{band: 0.5}
represents half of the band.- xanyOf(float, string,
ExprRef
) X coordinates of the marks, or width of horizontal
"bar"
and"area"
without specifiedx2
orwidth
.The
value
of this channel can be a number or a string"width"
for the width of the plot.- x2anyOf(float, string,
ExprRef
) 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.- x2OffsetanyOf(float,
ExprRef
) Offset for x2-position.
- xOffsetanyOf(float,
ExprRef
) Offset for x-position.
- yanyOf(float, string,
ExprRef
) Y coordinates of the marks, or height of vertical
"bar"
and"area"
without specifiedy2
orheight
.The
value
of this channel can be a number or a string"height"
for the height of the plot.- y2anyOf(float, string,
ExprRef
) 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.- y2OffsetanyOf(float,
ExprRef
) Offset for y2-position.
- yOffsetanyOf(float,
ExprRef
) Offset for y-position.
- type
- __init__(type=Undefined, align=Undefined, angle=Undefined, aria=Undefined, ariaRole=Undefined, ariaRoleDescription=Undefined, aspect=Undefined, bandSize=Undefined, baseline=Undefined, binSpacing=Undefined, blend=Undefined, clip=Undefined, color=Undefined, continuousBandSize=Undefined, cornerRadius=Undefined, cornerRadiusBottomLeft=Undefined, cornerRadiusBottomRight=Undefined, cornerRadiusEnd=Undefined, cornerRadiusTopLeft=Undefined, cornerRadiusTopRight=Undefined, cursor=Undefined, description=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, innerRadius=Undefined, interpolate=Undefined, invalid=Undefined, limit=Undefined, line=Undefined, lineBreak=Undefined, lineHeight=Undefined, opacity=Undefined, order=Undefined, orient=Undefined, outerRadius=Undefined, padAngle=Undefined, point=Undefined, radius=Undefined, radius2=Undefined, radius2Offset=Undefined, radiusOffset=Undefined, shape=Undefined, size=Undefined, smooth=Undefined, stroke=Undefined, strokeCap=Undefined, strokeDash=Undefined, strokeDashOffset=Undefined, strokeJoin=Undefined, strokeMiterLimit=Undefined, strokeOffset=Undefined, strokeOpacity=Undefined, strokeWidth=Undefined, style=Undefined, tension=Undefined, text=Undefined, theta=Undefined, theta2=Undefined, theta2Offset=Undefined, thetaOffset=Undefined, thickness=Undefined, timeUnitBandPosition=Undefined, timeUnitBandSize=Undefined, tooltip=Undefined, url=Undefined, width=Undefined, x=Undefined, x2=Undefined, x2Offset=Undefined, xOffset=Undefined, y=Undefined, y2=Undefined, y2Offset=Undefined, yOffset=Undefined, **kwds)#
Methods
__init__
([type, align, angle, aria, ...])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 rootschema