altair.theme.LegendConfigKwds#
- class altair.theme.LegendConfigKwds#
altair.LegendConfig
TypedDict
wrapper.- Parameters:
- aria
A boolean flag indicating if ARIA attributes should be included (SVG output only). If
false
, the “aria-hidden” attribute will be set on the output SVG group, removing the legend from the ARIA accessibility tree.Default value:
true
- clipHeight
The height in pixels to clip symbol legend entries and limit their size.
- columnPadding
The horizontal padding in pixels between symbol legend entries.
Default value:
10
.- columns
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
Corner radius for the full legend.
- description
A text description of this legend for ARIA accessibility (SVG output only). If the
aria
property is true, for SVG output the “aria-label” attribute will be set to this description. If the description is unspecified it will be automatically generated.- direction
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.
- disable
Disable legend by default
- fillColor
Background fill color for the full legend.
- gradientDirection
The default direction (
"horizontal"
or"vertical"
) for gradient legends.Default value:
"vertical"
.- gradientHorizontalMaxLength
Max legend length for a horizontal gradient when
config.legend.gradientLength
is undefined.Default value:
200
- gradientHorizontalMinLength
Min legend length for a horizontal gradient when
config.legend.gradientLength
is undefined.Default value:
100
- gradientLabelLimit
The maximum allowed length in pixels of color ramp gradient labels.
- gradientLabelOffset
Vertical offset in pixels for color ramp gradient labels.
Default value:
2
.- gradientLength
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
Opacity of the color gradient.
- gradientStrokeColor
The color of the gradient stroke, can be in hex color code or regular color name.
Default value:
"lightGray"
.- gradientStrokeWidth
The width of the gradient stroke, in pixels.
Default value:
0
.- gradientThickness
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
Max legend length for a vertical gradient when
config.legend.gradientLength
is undefined.Default value:
200
- gradientVerticalMinLength
Min legend length for a vertical gradient when
config.legend.gradientLength
is undefined.Default value:
100
- gridAlign
The alignment to apply to symbol legends rows and columns. The supported string values are
"all"
,"each"
(the default), andnone
. For more information, see the grid layout documentation.Default value:
"each"
.- labelAlign
The alignment of the legend label, can be left, center, or right.
- labelBaseline
The position of the baseline of legend label, can be
"top"
,"middle"
,"bottom"
, or"alphabetic"
.Default value:
"middle"
.- labelColor
The color of the legend label, can be in hex color code or regular color name.
- labelFont
The font of the legend label.
- labelFontSize
The font size of legend label.
Default value:
10
.- labelFontStyle
The font style of legend label.
- labelFontWeight
The font weight of legend label.
- labelLimit
Maximum allowed pixel width of legend tick labels.
Default value:
160
.- labelOffset
The offset of the legend label.
Default value:
4
.- labelOpacity
Opacity of labels.
- labelOverlap
The strategy to use for resolving overlap of labels in gradient legends. If
false
, no overlap reduction is attempted. If set totrue
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).- labelPadding
Padding in pixels between the legend and legend labels.
- labelSeparation
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
- legendX
Custom x-position for legend with orient “none”.
- legendY
Custom y-position for legend with orient “none”.
- offset
The offset in pixels by which to displace the legend from the data rectangle and axes.
Default value:
18
.- orient
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
The padding between the border and content of the legend group.
Default value:
0
.- rowPadding
The vertical padding in pixels between symbol legend entries.
Default value:
2
.- strokeColor
Border stroke color for the full legend.
- strokeDash
Border stroke dash pattern for the full legend.
- strokeWidth
Border stroke width for the full legend.
- symbolBaseFillColor
Default fill color for legend symbols. Only applied if there is no
"fill"
scale color encoding for the legend.Default value:
"transparent"
.- symbolBaseStrokeColor
Default stroke color for legend symbols. Only applied if there is no
"fill"
scale color encoding for the legend.Default value:
"gray"
.- symbolDash
An array of alternating [stroke, space] lengths for dashed symbol strokes.
- symbolDashOffset
The pixel offset at which to start drawing with the symbol stroke dash array.
- symbolDirection
The default direction (
"horizontal"
or"vertical"
) for symbol legends.Default value:
"vertical"
.- symbolFillColor
The color of the legend symbol,
- symbolLimit
The maximum number of allowed entries for a symbol legend. Additional entries will be dropped.
- symbolOffset
Horizontal pixel offset for legend symbols.
Default value:
0
.- symbolOpacity
Opacity of the legend symbols.
- symbolSize
The size of the legend symbol, in pixels.
Default value:
100
.- symbolStrokeColor
Stroke color for legend symbols.
- symbolStrokeWidth
The width of the symbol’s stroke.
Default value:
1.5
.- symbolType
The symbol shape. One of the plotting shapes
circle
(default),square
,cross
,diamond
,triangle-up
,triangle-down
,triangle-right
, ortriangle-left
, the line symbolstroke
, or one of the centered directional shapesarrow
,wedge
, ortriangle
. 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
The desired number of tick values for quantitative legends.
- title
Set to null to disable title for the axis, legend, or header.
- titleAlign
Horizontal text alignment for legend titles.
Default value:
"left"
.- titleAnchor
Text anchor position for placing legend titles.
- titleBaseline
Vertical text baseline for legend titles. One of
"alphabetic"
(default),"top"
,"middle"
,"bottom"
,"line-top"
, or"line-bottom"
. The"line-top"
and"line-bottom"
values operate similarly to"top"
and"bottom"
, but are calculated relative to the lineHeight rather than fontSize alone.Default value:
"top"
.- titleColor
The color of the legend title, can be in hex color code or regular color name.
- titleFont
The font of the legend title.
- titleFontSize
The font size of the legend title.
- titleFontStyle
The font style of the legend title.
- titleFontWeight
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
Maximum allowed pixel width of legend titles.
Default value:
180
.- titleLineHeight
Line height in pixels for multi-line title text or title text with
"line-top"
or"line-bottom"
baseline.- titleOpacity
Opacity of the legend title.
- titleOrient
Orientation of the legend title.
- titlePadding
The padding, in pixels, between title and legend.
Default value:
5
.- unselectedOpacity
The opacity of unselected legend entries.
Default value: 0.35.
- zindex
The integer z-index indicating the layering of the legend group relative to other axis, mark, and legend groups.
- __init__(*args, **kwargs)#
Methods
__init__
(*args, **kwargs)clear
()copy
()fromkeys
(iterable[, value])Create a new dictionary with keys from iterable and values set to value.
get
(key[, default])Return the value for key if key is in the dictionary, else default.
items
()keys
()pop
(key[, default])If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem
(/)Remove and return a (key, value) pair as a 2-tuple.
setdefault
(key[, default])Insert key with a value of default if key is not in the dictionary.
update
([E, ]**F)If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
values
()Attributes
aria
clipHeight
columnPadding
columns
cornerRadius
description
direction
disable
fillColor
gradientDirection
gradientHorizontalMaxLength
gradientHorizontalMinLength
gradientLabelLimit
gradientLabelOffset
gradientLength
gradientOpacity
gradientStrokeColor
gradientStrokeWidth
gradientThickness
gradientVerticalMaxLength
gradientVerticalMinLength
gridAlign
labelAlign
labelBaseline
labelColor
labelFont
labelFontSize
labelFontStyle
labelFontWeight
labelLimit
labelOffset
labelOpacity
labelOverlap
labelPadding
labelSeparation
layout
legendX
legendY
offset
orient
padding
rowPadding
strokeColor
strokeDash
strokeWidth
symbolBaseFillColor
symbolBaseStrokeColor
symbolDash
symbolDashOffset
symbolDirection
symbolFillColor
symbolLimit
symbolOffset
symbolOpacity
symbolSize
symbolStrokeColor
symbolStrokeWidth
symbolType
tickCount
title
titleAlign
titleAnchor
titleBaseline
titleColor
titleFont
titleFontSize
titleFontStyle
titleFontWeight
titleLimit
titleLineHeight
titleOpacity
titleOrient
titlePadding
unselectedOpacity
zindex