inspect_viz.plot
Plot
plot
Create a plot.
def plot(
*plot: Mark | Interactor | Legend | Sequence[Mark | Interactor | Legend],
x_label: str | Param | None | NotGiven = NOT_GIVEN,
fx_label: str | Param | None | NotGiven = NOT_GIVEN,
y_label: str | Param | None | NotGiven = NOT_GIVEN,
fy_label: str | Param | None | NotGiven = NOT_GIVEN,
title: str | Title | None = None,
width: float | Param | None = None,
height: float | Param | None = None,
name: str | None = None,
legend: Literal["color", "opacity", "symbol"]
| Sequence[Literal["color", "opacity", "symbol"]]
| Legend
| Sequence[Legend]
| None = None,
**attributes: Unpack[PlotAttributes],
) -> Component*plotMark | Interactor | Legend | Sequence[Mark | Interactor | Legend]-
Plot elements (marks, interactors, legends)
x_labelstr | Param | None | NotGiven-
A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value. Pass
Nonefor no x_label. fx_labelstr | Param | None | NotGiven-
A textual label to show on the axis or legend; if
None, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value. y_labelstr | Param | None | NotGiven-
A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value. Pass
Nonefor no y_label. fy_labelstr | Param | None | NotGiven-
A textual label to show on the axis or legend; if
None, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value. titlestr | Title | None-
Title for plot (
stror mark created with the title() function). widthfloat | Param | None-
The outer width of the plot in pixels, including margins. Defaults to 700.
heightfloat | Param | None-
The outer height of the plot in pixels, including margins. The default is width / 1.618 (the golden ratio)
namestr | None-
A unique name for the plot. The name is used by standalone legend components to to lookup the plot and access scale mappings.
legendLiteral['color', 'opacity', 'symbol'] | Sequence[Literal['color', 'opacity', 'symbol']] | Legend | Sequence[Legend] | None-
Plot legend.
**attributesUnpack[PlotAttributes]-
Additional PlotAttributes.
PlotAttributes
Plot attributes.
class PlotAttributes(TypedDict, total=False)Attributes
aspect_ratiofloat | bool | None | Param | None-
The desired aspect ratio of the x and y scales, affecting the default height. Given an aspect ratio of dx / dy, and assuming that the x and y scales represent equivalent units (say, degrees Celsius or meters), computes a default height such that dx pixels along x represents the same variation as dy pixels along y. Note: when faceting, set the fx and fy scales’ round option to false for an exact aspect ratio.
marginfloat | Param | None-
Shorthand to set the same default for all four margins: margin_top, margin_right, margin_bottom, and margin_left. Otherwise, the default margins depend on the maximum margins of the plot’s marks. While most marks default to zero margins (because they are drawn inside the chart area), Plot’s axis marks have non-zero default margins.
margin_topfloat | Param | None-
The top margin; the distance in pixels between the top edges of the inner and outer plot area. Defaults to the maximum top margin of the plot’s marks.
margin_rightfloat | Param | None-
The right margin; the distance in pixels between the right edges of the inner and outer plot area. Defaults to the maximum right margin of the plot’s marks.
margin_bottomfloat | Param | None-
The bottom margin; the distance in pixels between the bottom edges of the inner and outer plot area. Defaults to the maximum bottom margin of the plot’s marks.
margin_leftfloat | Param | None-
The left margin; the distance in pixels between the left edges of the inner and outer plot area. Defaults to the maximum left margin of the plot’s marks.
marginsdict[str, float | Param] | None-
A shorthand object notation for setting multiple margin values. The object keys are margin names (top, right, etc).
insetfloat | Param | None-
Shorthand to set the same default for all four insets: inset_top, inset_right, inset_bottom, and inset_left. All insets typically default to zero, though not always (say when using bin transform). A positive inset reduces effective area, while a negative inset increases it.
alignfloat | Param | None-
How to distribute unused space in the range for point and band scales. A number in [0, 1], such as:
- 0 - use the start of the range, putting unused space at the end
- 0.5 (default) - use the middle, distributing unused space evenly
- 1 use the end, putting unused space at the start
For ordinal position scales only.
paddingfloat | Param | None-
For band scales, how much of the range to reserve to separate adjacent bands; defaults to 0.1 (10%). For point scales, the amount of inset for the first and last value as a proportion of the bandwidth; defaults to 0.5 (50%).
For ordinal position scales only.
axisLiteral['top', 'right', 'bottom', 'left', 'both'] | bool | None | Param-
The side of the frame on which to place the implicit axis: top or bottom for x or fx, or left or right for y or fy. The default depends on the scale:
- x - bottom
- y - left
- fx - top if there is a bottom x axis, and otherwise bottom
- fy - right if there is a left y axis, and otherwise right
If both, an implicit axis will be rendered on both sides of the plot (top and bottom for x or fx, or left and right for y or fy). If null, the implicit axis is suppressed.
For position axes only.
gridbool | str | Param-
Whether to show a grid aligned with the scale’s ticks. If true, show a grid with the currentColor stroke; if a string, show a grid with the specified stroke color.
aria_labelstr | None-
The aria-label attribute on the SVG root.
aria_descriptionstr | None-
The aria-description attribute on the SVG root.
clipLiteral['frame', 'sphere'] | bool | None | Param-
The default clip for all marks.
x_scalePositionScale | None | Param | None-
The x scale type, affecting how the scale encodes abstract data, say by applying a mathematical transformation. If null, the scale is disabled.
For quantitative data (numbers), defaults to linear; for temporal data (dates), defaults to utc; for ordinal data (strings or booleans), defaults to point for position scales, categorical for color scales, and otherwise ordinal. However, the radius scale defaults to sqrt, and the length and opacity scales default to linear; these scales are intended for quantitative data. The plot’s marks may also impose a scale type; for example, the barY mark requires that x is a band scale.
x_domainLiteral['fixed'] | Sequence[str | float | bool] | Param | None-
The extent of the scale’s inputs (abstract values). By default inferred from channel values. For continuous data (numbers and dates), it is typically [min, max]; it can be [max, min] to reverse the scale. For ordinal data (strings or booleans), it is an array (or iterable) of values is the desired order, defaulting to natural ascending order.
Linear scales have a default domain of [0, 1]. Log scales have a default domain of [1, 10] and cannot include zero. Radius scales have a default domain from 0 to the median first quartile of associated channels. Length have a default domain from 0 to the median median of associated channels. Opacity scales have a default domain from 0 to the maximum value of associated channels.
x_rangeSequence[str | float | bool] | Param | None-
The extent of the scale’s outputs (visual values). By default inferred from the scale’s type and domain, and for position scales, the plot’s dimensions. For continuous data (numbers and dates), and for ordinal position scales (point and band), it is typically [min, max]; it can be [max, min] to reverse the scale.
x_nicebool | float | Interval | Param | None-
If true, or a tick count or interval, extend the domain to nice round values. Defaults to 1, 2 or 5 times a power of 10 for linear scales, and nice time intervals for utc and time scales. Pass an interval such as minute, wednesday or month to specify what constitutes a nice interval.
For continuous scales only.
x_insetfloat | Param | None-
Shorthand to set the same default for all four insets: inset_top, inset_right, inset_bottom, and inset_left. All insets typically default to zero, though not always (say when using bin transform). A positive inset reduces effective area, while a negative inset increases it.
x_inset_rightfloat | Param | None-
Insets the right edge by the specified number of pixels. A positive value insets towards the left edge (reducing effective area), while a negative value insets away from the left edge (increasing it).
x_inset_leftfloat | Param | None-
Insets the left edge by the specified number of pixels. A positive value insets towards the right edge (reducing effective area), while a negative value insets away from the right edge (increasing it).
x_clampbool | Param | None-
If true, values below the domain minimum are treated as the domain minimum, and values above the domain maximum are treated as the domain maximum.
Clamping is useful for focusing on a subset of the data while ensuring that extreme values remain visible, but use caution: clamped values may need an annotation to avoid misinterpretation. Clamping typically requires setting an explicit domain since if the domain is inferred, no values will be outside the domain.
For continuous scales only.
x_roundbool | Param | None-
If true, round the output value to the nearest integer (pixel); useful for crisp edges when rendering.
For position scales only.
x_alignfloat | Param | None-
How to distribute unused space in the range for point and band scales. A number in [0, 1], such as:
- 0 - use the start of the range, putting unused space at the end
- 0.5 (default) - use the middle, distributing unused space evenly
- 1 use the end, putting unused space at the start
For ordinal position scales only.
x_paddingfloat | Param | None-
For band scales, how much of the range to reserve to separate adjacent bands; defaults to 0.1 (10%). For point scales, the amount of inset for the first and last value as a proportion of the bandwidth; defaults to 0.5 (50%).
For ordinal position scales only.
x_padding_innerfloat | Param | None-
For a band scale, how much of the range to reserve to separate adjacent bands.
x_padding_outerfloat | Param | None-
For a band scale, how much of the range to reserve to inset first and last bands.
x_axisLiteral['top', 'bottom', 'both'] | bool | None | Param | None-
The side of the frame on which to place the implicit axis: top or bottom for x. Defaults to bottom for an x scale.
If both, an implicit axis will be rendered on both sides of the plot (top and bottom for x). If null, the implicit axis is suppressed.
x_ticksfloat | Interval | Sequence[str | float | bool] | Param | None-
The desired approximate number of axis ticks, or an explicit array of tick values, or an interval such as day or month.
x_tick_sizefloat | Param | None-
The length of axis tick marks in pixels; negative values extend in the opposite direction. Defaults to 6 for x and y axes and color and opacity ramp legends, and 0 for fx and fy axes.
x_tick_spacingfloat | Param | None-
The desired approximate spacing between adjacent axis ticks, affecting the default ticks; defaults to 80 pixels for x and fx, and 35 pixels for y and fy.
x_tick_paddingfloat | Param | None-
The distance between an axis tick mark and its associated text label (in pixels); often defaults to 3, but may be affected by x_tick_size and x_tick_rotate.
x_tick_formatstr | None | Param | None-
How to format inputs (abstract values) for axis tick labels; one of:
- a d3-format string for numeric scales
- a d3-time-format string for temporal scales
x_tick_rotatefloat | Param | None-
The rotation angle of axis tick labels in degrees clocksize; defaults to 0.
x_gridbool | str | Interval | list[str | float] | Param-
Whether to show a grid aligned with the scale’s ticks. If true, show a grid with the currentColor stroke; if a string, show a grid with the specified stroke color; if an approximate number of ticks, an interval, or an array of tick values, show corresponding grid lines.
x_linebool | Param | None-
If true, draw a line along the axis; if false (default), do not.
x_label_anchorLiteral['right', 'left', 'center'] | Param | None-
Where to place the axis label relative to the plot’s frame. For vertical position scales (y and fy), may be top, bottom, or center; for horizontal position scales (x and fx), may be left, right, or center. Defaults to center for ordinal scales (including fx and fy), and otherwise top for y, and right for x.
x_label_arrowLabelArrow | Param | None-
Whether to apply a directional arrow such as → or ↑ to the x-axis scale label. If auto (the default), the presence of the arrow depends on whether the scale is ordinal.
x_label_offsetfloat | Param | None-
The axis label position offset (in pixels); default depends on margins and orientation.
x_font_variantstr | Param | None-
The font-variant attribute for axis ticks; defaults to tabular-nums for quantitative axes.
x_aria_labelstr | Param | None-
A short label representing the axis in the accessibility tree.
x_aria_descriptionstr | Param | None-
A textual description for the axis in the accessibility tree.
x_percentbool | Param | None-
If true, shorthand for a transform suitable for percentages, mapping proportions in [0, 1] to [0, 100].
x_reversebool | Param | None-
Whether to reverse the scale’s encoding; equivalent to reversing either the domain or range.
x_zerobool | Param | None-
Whether the domain must include zero. If the domain minimum is positive, it will be set to zero; otherwise if the domain maximum is negative, it will be set to zero.
For quantitative scales only.
x_exponentfloat | Param | None-
A power scale’s exponent (e.g., 0.5 for sqrt); defaults to 1 for a linear scale. For pow scales only.
x_basefloat | Param | None-
A log scale’s base; defaults to 10. Does not affect the scale’s encoding, but rather the default ticks. For log scales only.
x_constantfloat | Param | None-
A symlog scale’s constant, expressing the magnitude of the linear region around the origin; defaults to 1. For symlog scales only.
y_scalePositionScale | None | Param | None-
The y scale type, affecting how the scale encodes abstract data, say by applying a mathematical transformation. If null, the scale is disabled.
For quantitative data (numbers), defaults to linear; for temporal data (dates), defaults to utc; for ordinal data (strings or booleans), defaults to point for position scales, The plot’s marks may also impose a scale type; for example, the barY mark requires that x is a band scale.
y_domainLiteral['fixed'] | Sequence[str | float | bool] | Param | None-
The extent of the scale’s inputs (abstract values). By default inferred from channel values. For continuous data (numbers and dates), it is typically [min, max]; it can be [max, min] to reverse the scale. For ordinal data (strings or booleans), it is an array (or iterable) of values is the desired order, defaulting to natural ascending order.
Linear scales have a default domain of [0, 1]. Log scales have a default domain of [1, 10] and cannot include zero.
y_rangeSequence[str | float | bool] | Param | None-
The extent of the scale’s outputs (visual values). By default inferred from the scale’s type and domain, and for position scales, the plot’s dimensions. For continuous data (numbers and dates), and for ordinal position scales (point and band), it is typically [min, max]; it can be [max, min] to reverse the scale.
y_nicebool | float | Interval | Param | None-
If true, or a tick count or interval, extend the domain to nice round values. Defaults to 1, 2 or 5 times a power of 10 for linear scales, and nice time intervals for utc and time scales. Pass an interval such as minute, wednesday or month to specify what constitutes a nice interval.
For continuous scales only.
y_insetfloat | Param | None-
Shorthand to set the same default for all four insets: inset_top, inset_right, inset_bottom, and inset_left. All insets typically default to zero, though not always (say when using bin transform). A positive inset reduces effective area, while a negative inset increases it.
y_inset_topfloat | Param | None-
Insets the top edge by the specified number of pixels. A positive value insets towards the bottom edge (reducing effective area), while a negative value insets away from the bottom edge (increasing it).
y_inset_bottomfloat | Param | None-
Insets the bottom edge by the specified number of pixels. A positive value insets towards the top edge (reducing effective area), while a negative value insets away from the top edge (increasing it).
y_clampbool | Param | None-
If true, values below the domain minimum are treated as the domain minimum, and values above the domain maximum are treated as the domain maximum.
Clamping is useful for focusing on a subset of the data while ensuring that extreme values remain visible, but use caution: clamped values may need an annotation to avoid misinterpretation. Clamping typically requires setting an explicit domain since if the domain is inferred, no values will be outside the domain.
For continuous scales only.
y_roundbool | Param | None-
If true, round the output value to the nearest integer (pixel); useful for crisp edges when rendering.
For position scales only.
y_alignfloat | Param | None-
How to distribute unused space in the range for point and band scales. A number in [0, 1], such as:
- 0 - use the start of the range, putting unused space at the end
- 0.5 (default) - use the middle, distributing unused space evenly
- 1 use the end, putting unused space at the start
For ordinal position scales only.
y_paddingfloat | Param | None-
For band scales, how much of the range to reserve to separate adjacent bands; defaults to 0.1 (10%). For point scales, the amount of inset for the first and last value as a proportion of the bandwidth; defaults to 0.5 (50%).
For ordinal position scales only.
y_padding_innerfloat | Param | None-
For a band scale, how much of the range to reserve to separate adjacent bands.
y_padding_outerfloat | Param | None-
For a band scale, how much of the range to reserve to inset first and last bands.
y_axisLiteral['left', 'right', 'both'] | bool | None | Param | None-
The side of the frame on which to place the implicit axis: left or right for y. Defaults to left for a y scale.
If both, an implicit axis will be rendered on both sides of the plot (left and right for y). If null, the implicit axis is suppressed.
y_ticksfloat | Interval | Sequence[str | float | bool] | Param | None-
The desired approximate number of axis ticks, or an explicit array of tick values, or an interval such as day or month.
y_tick_sizefloat | Param | None-
The length of axis tick marks in pixels; negative values extend in the opposite direction. Defaults to 6 for x and y axes and color and opacity ramp legends, and 0 for fx and fy axes.
y_tick_spacingfloat | Param | None-
The desired approximate spacing between adjacent axis ticks, affecting the default ticks; defaults to 80 pixels for x and fx, and 35 pixels for y and fy.
y_tick_paddingfloat | Param | None-
The distance between an axis tick mark and its associated text label (in pixels); often defaults to 3, but may be affected by y_tick_size and y_tick_rotate.
y_tick_formatstr | None | Param | None-
How to format inputs (abstract values) for axis tick labels; one of:
- a d3-format string for numeric scales
- a d3-time-format string for temporal scales
y_tick_rotatefloat | Param | None-
The rotation angle of axis tick labels in degrees clocksize; defaults to 0.
y_gridbool | str | Interval | list[str | float] | Param-
Whether to show a grid aligned with the scale’s ticks. If true, show a grid with the currentColor stroke; if a string, show a grid with the specified stroke color; if an approximate number of ticks, an interval, or an array of tick values, show corresponding grid lines.
y_linebool | Param | None-
If true, draw a line along the axis; if false (default), do not.
y_label_anchorLiteral['top', 'bottom', 'center'] | Param | None-
Where to place the axis label relative to the plot’s frame. For vertical position scales (y and fy), may be top, bottom, or center; for horizontal position scales (x and fx), may be left, right, or center. Defaults to center for ordinal scales (including fx and fy), and otherwise top for y, and right for x.
y_label_arrowLabelArrow | Param | None-
Whether to apply a directional arrow such as → or ↑ to the x-axis scale label. If auto (the default), the presence of the arrow depends on whether the scale is ordinal.
y_label_offsetfloat | Param | None-
The axis label position offset (in pixels); default depends on margins and orientation.
y_font_variantstr | Param | None-
The font-variant attribute for axis ticks; defaults to tabular-nums for quantitative axes.
y_aria_labelstr | Param | None-
A short label representing the axis in the accessibility tree.
y_aria_descriptionstr | Param | None-
A textual description for the axis in the accessibility tree.
y_percentbool | Param | None-
If true, shorthand for a transform suitable for percentages, mapping proportions in [0, 1] to [0, 100].
y_reversebool | Param | None-
Whether to reverse the scale’s encoding; equivalent to reversing either the domain or range. Note that by default, when the y scale is continuous, the max value points to the top of the screen, whereas ordinal values are ranked from top to bottom.
y_zerobool | Param | None-
Whether the domain must include zero. If the domain minimum is positive, it will be set to zero; otherwise if the domain maximum is negative, it will be set to zero.
For quantitative scales only.
y_exponentfloat | Param | None-
A power scale’s exponent (e.g., 0.5 for sqrt); defaults to 1 for a linear scale. For pow scales only.
y_basefloat | Param | None-
A log scale’s base; defaults to 10. Does not affect the scale’s encoding, but rather the default ticks. For log scales only.
y_constantfloat | Param | None-
A symlog scale’s constant, expressing the magnitude of the linear region around the origin; defaults to 1. For symlog scales only.
xy_domainLiteral['fixed'] | Sequence[str | float | bool] | Param | None-
Set the x and y scale domains.
facet_marginfloat | Param | None-
Shorthand to set the same default for all four facet margins: margin_top, margin_right, margin_bottom, and margin_left.
facet_margin_topfloat | Param | None-
The top facet margin; the (minimum) distance in pixels between the top edges of the inner and outer plot area.
facet_margin_bottomfloat | Param | None-
The right facet margin; the (minimum) distance in pixels between the right edges of the inner and outer plot area.
facet_margin_leftfloat | Param | None-
The bottom facet margin; the (minimum) distance in pixels between the bottom edges of the inner and outer plot area.
facet_margin_rightfloat | Param | None-
The left facet margin; the (minimum) distance in pixels between the left edges of the inner and outer plot area.
facet_gridbool | str | Interval | Sequence[str | float | bool] | Param | None-
Default axis grid for fx and fy scales; typically set to true to enable.
facet_labelstr | None | Param | None-
Default axis label for fx and fy scales; typically set to null to disable.
fx_domainLiteral['fixed'] | Sequence[str | float | bool] | Param | None-
The extent of the scale’s inputs (abstract values). By default inferred from channel values. For ordinal data (strings or booleans), it is an array (or iterable) of values is the desired order, defaulting to natural ascending order.
fx_rangeSequence[str | float | bool] | Param | None-
The extent of the scale’s outputs (visual values). By default inferred from the scale’s type and domain, and the plot’s dimensions. For ordinal position scales (point and band), it is typically [min, max]; it can be [max, min] to reverse the scale.
fx_insetfloat | Param | None-
Shorthand to set the same default for all four insets: inset_top, inset_right, inset_bottom, and inset_left. All insets typically default to zero, though not always (say when using bin transform). A positive inset reduces effective area, while a negative inset increases it.
fx_inset_rightfloat | Param | None-
Insets the right edge by the specified number of pixels. A positive value insets towards the left edge (reducing effective area), while a negative value insets away from the left edge (increasing it).
fx_inset_leftfloat | Param | None-
Insets the left edge by the specified number of pixels. A positive value insets towards the right edge (reducing effective area), while a negative value insets away from the right edge (increasing it).
fx_roundbool | Param | None-
If true, round the output value to the nearest integer (pixel); useful for crisp edges when rendering.
For position scales only.
fx_alignfloat | Param | None-
How to distribute unused space in the range for point and band scales. A number in [0, 1], such as:
- 0 - use the start of the range, putting unused space at the end
- 0.5 (default) - use the middle, distributing unused space evenly
- 1 use the end, putting unused space at the start
For ordinal position scales only.
fx_paddingfloat | Param | None-
For band scales, how much of the range to reserve to separate adjacent bands; defaults to 0.1 (10%). For point scales, the amount of inset for the first and last value as a proportion of the bandwidth; defaults to 0.5 (50%).
For ordinal position scales only.
fx_padding_innerfloat | Param | None-
For a band scale, how much of the range to reserve to separate adjacent bands.
fx_padding_outerfloat | Param | None-
For a band scale, how much of the range to reserve to inset first and last bands.
fx_axisLiteral['top', 'bottom', 'both'] | bool | None | Param | None-
The side of the frame on which to place the implicit axis: top or bottom for fx. Defaults to top if there is a bottom x axis, and otherwise bottom.
If both, an implicit axis will be rendered on both sides of the plot (top and bottom for fx). If null, the implicit axis is suppressed.
fx_ticksfloat | Interval | Sequence[str | float | bool] | Param | None-
The desired approximate number of axis ticks, or an explicit array of tick values, or an interval such as day or month.
fx_tick_sizefloat | Param | None-
The length of axis tick marks in pixels; negative values extend in the opposite direction. Defaults to 6 for x and y axes and color and opacity ramp legends, and 0 for fx and fy axes.
fx_tick_spacingfloat | Param | None-
The desired approximate spacing between adjacent axis ticks, affecting the default ticks; defaults to 80 pixels for x and fx, and 35 pixels for y and fy.
fx_tick_paddingfloat | Param | None-
The distance between an axis tick mark and its associated text label (in pixels); often defaults to 3, but may be affected by fx_tick_size and fx_tick_rotate.
fx_tick_formatstr | None | Param | None-
How to format inputs (abstract values) for axis tick labels; one of:
- a d3-format string for numeric scales
- a d3-time-format string for temporal scales
fx_tick_rotatefloat | Param | None-
The rotation angle of axis tick labels in degrees clocksize; defaults to 0.
fx_gridbool | str | Interval | Sequence[str | float | bool] | Param | None-
Whether to show a grid aligned with the scale’s ticks. If true, show a grid with the currentColor stroke; if a string, show a grid with the specified stroke color; if an approximate number of ticks, an interval, or an array of tick values, show corresponding grid lines. See also the grid mark.
For axes only.
fx_linebool | Param | None-
If true, draw a line along the axis; if false (default), do not.
fx_label_anchorLiteral['right', 'left', 'center'] | Param | None-
Where to place the axis label relative to the plot’s frame. For vertical position scales (y and fy), may be top, bottom, or center; for horizontal position scales (x and fx), may be left, right, or center. Defaults to center for ordinal scales (including fx and fy), and otherwise top for y, and right for x.
fx_label_offsetfloat | Param | None-
The axis label position offset (in pixels); default depends on margins and orientation.
fx_font_variantstr | Param | None-
The font-variant attribute for axis ticks; defaults to tabular-nums for quantitative axes.
fx_aria_labelstr | Param | None-
A short label representing the axis in the accessibility tree.
fx_aria_descriptionstr | Param | None-
A textual description for the axis in the accessibility tree.
fx_reversebool | Param | None-
Whether to reverse the scale’s encoding; equivalent to reversing either the domain or range.
fy_domainLiteral['fixed'] | Sequence[str | float | bool] | Param | None-
The extent of the scale’s inputs (abstract values). By default inferred from channel values. For ordinal data (strings or booleans), it is an array (or iterable) of values is the desired order, defaulting to natural ascending order.
fy_rangeSequence[str | float | bool] | Param | None-
The extent of the scale’s outputs (visual values). By default inferred from the scale’s type and domain, and the plot’s dimensions. For ordinal position scales (point and band), it is typically [min, max]; it can be [max, min] to reverse the scale.
fy_insetfloat | Param | None-
Shorthand to set the same default for all four insets: inset_top, inset_right, inset_bottom, and inset_left. All insets typically default to zero, though not always (say when using bin transform). A positive inset reduces effective area, while a negative inset increases it.
fy_inset_topfloat | Param | None-
Insets the top edge by the specified number of pixels. A positive value insets towards the bottom edge (reducing effective area), while a negative value insets away from the bottom edge (increasing it).
fy_inset_bottomfloat | Param | None-
Insets the bottom edge by the specified number of pixels. A positive value insets towards the top edge (reducing effective area), while a negative value insets away from the top edge (increasing it).
fy_roundbool | Param | None-
If true, round the output value to the nearest integer (pixel); useful for crisp edges when rendering.
For position scales only.
fy_alignfloat | Param | None-
How to distribute unused space in the range for point and band scales. A number in [0, 1], such as:
- 0 - use the start of the range, putting unused space at the end
- 0.5 (default) - use the middle, distributing unused space evenly
- 1 use the end, putting unused space at the start
For ordinal position scales only.
fy_paddingfloat | Param | None-
For band scales, how much of the range to reserve to separate adjacent bands; defaults to 0.1 (10%). For point scales, the amount of inset for the first and last value as a proportion of the bandwidth; defaults to 0.5 (50%).
For ordinal position scales only.
fy_padding_innerfloat | Param | None-
For a band scale, how much of the range to reserve to separate adjacent bands.
fy_padding_outerfloat | Param | None-
For a band scale, how much of the range to reserve to inset first and last bands.
fy_axisLiteral['left', 'right', 'both'] | bool | None | Param | None-
The side of the frame on which to place the implicit axis: left or right for fy. Defaults to left for an fy scale.
If both, an implicit axis will be rendered on both sides of the plot (left and right for fy). If null, the implicit axis is suppressed.
fy_ticksfloat | Interval | Sequence[str | float | bool] | Param | None-
The desired approximate number of axis ticks, or an explicit array of tick values, or an interval such as day or month.
fy_tick_sizefloat | Param | None-
The length of axis tick marks in pixels; negative values extend in the opposite direction. Defaults to 6 for x and y axes and color and opacity ramp legends, and 0 for fx and fy axes.
fy_tick_spacingfloat | Param | None-
The desired approximate spacing between adjacent axis ticks, affecting the default ticks; defaults to 80 pixels for x and fx, and 35 pixels for y and fy.
fy_tick_paddingfloat | Param | None-
The distance between an axis tick mark and its associated text label (in pixels); often defaults to 3, but may be affected by fy_tick_size and fy_tick_rotate.
fy_tick_formatstr | None | Param | None-
How to format inputs (abstract values) for axis tick labels; one of:
- a d3-format string for numeric scales
- a d3-time-format string for temporal scales
fy_tick_rotatefloat | Param | None-
The rotation angle of axis tick labels in degrees clocksize; defaults to 0.
fy_gridbool | str | Interval | Sequence[str | float | bool] | Param | None-
Whether to show a grid aligned with the scale’s ticks. If true, show a grid with the currentColor stroke; if a string, show a grid with the specified stroke color; if an approximate number of ticks, an interval, or an array of tick values, show corresponding grid lines. See also the grid mark.
For axes only.
fy_linebool | Param | None-
If true, draw a line along the axis; if false (default), do not.
fy_label_anchorLiteral['top', 'bottom', 'center'] | Param | None-
Where to place the axis label relative to the plot’s frame. For vertical position scales (y and fy), may be top, bottom, or center; for horizontal position scales (x and fx), may be left, right, or center. Defaults to center for ordinal scales (including fx and fy), and otherwise top for y, and right for x.
fy_label_offsetfloat | Param | None-
The axis label position offset (in pixels); default depends on margins and orientation.
fy_font_variantstr | Param | None-
The font-variant attribute for axis ticks; defaults to tabular-nums for quantitative axes.
fy_aria_labelstr | Param | None-
A short label representing the axis in the accessibility tree.
fy_aria_descriptionstr | Param | None-
A textual description for the axis in the accessibility tree.
fy_reversebool | Param | None-
Whether to reverse the scale’s encoding; equivalent to reversing either the domain or range.
color_scaleColorScale | None | Param | None-
The color scale type, affecting how the scale encodes abstract data, say by applying a mathematical transformation. If null, the scale is disabled.
For quantitative data (numbers), defaults to linear; for temporal data (dates), defaults to utc; for ordinal data (strings or booleans), defaults to point for position scales, categorical for color scales, and otherwise ordinal.
color_domainLiteral['fixed'] | Sequence[str | float | bool] | Param | None-
The extent of the scale’s inputs (abstract values). By default inferred from channel values. For continuous data (numbers and dates), it is typically [min, max]; it can be [max, min] to reverse the scale. For ordinal data (strings or booleans), it is an array (or iterable) of values is the desired order, defaulting to natural ascending order.
color_rangeSequence[str | float | bool] | Param | None-
The extent of the scale’s outputs (visual values). By default inferred from the scale’s type and domain. For other ordinal data, it is an array (or iterable) of output values in the same order as the domain.
color_clampbool | Param | None-
If true, values below the domain minimum are treated as the domain minimum, and values above the domain maximum are treated as the domain maximum.
Clamping is useful for focusing on a subset of the data while ensuring that extreme values remain visible, but use caution: clamped values may need an annotation to avoid misinterpretation. Clamping typically requires setting an explicit domain since if the domain is inferred, no values will be outside the domain.
For continuous scales only.
color_nfloat | Param | None-
For a quantile scale, the number of quantiles (creates n - 1 thresholds); for a quantize scale, the approximate number of thresholds; defaults to 5.
color_nicebool | float | Interval | Param | None-
If true, or a tick count or interval, extend the domain to nice round values. Defaults to 1, 2 or 5 times a power of 10 for linear scales, and nice time intervals for utc and time scales. Pass an interval such as minute, wednesday or month to specify what constitutes a nice interval.
For continuous scales only.
color_schemeColorScheme | Param | None-
If specified, shorthand for setting the color_range or color_interpolate option of a color scale.
color_interpolateInterpolate | Param | None-
How to interpolate color range values. For quantitative scales only. This attribute can be used to specify a color space for interpolating colors specified in the color_range.
color_pivotAny | Param | None-
For a diverging color scale, the input value (abstract value) that divides the domain into two parts; defaults to 0 for diverging scales, dividing the domain into negative and positive parts; defaults to 1 for diverging-log scales. By default, diverging scales are symmetric around the pivot; see the symmetric option.
color_symmetricbool | Param | None-
For a diverging color scale, if true (the default), extend the domain to ensure that the lower part of the domain (below the pivot) is commensurate with the upper part of the domain (above the pivot).
A symmetric diverging color scale may not use all of its output range; this reduces contrast but ensures that deviations both below and above the pivot are represented proportionally. Otherwise if false, the full output range will be used; this increases contrast but values on opposite sides of the pivot may not be meaningfully compared.
color_labelstr | None | Param | None-
A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value.
For axes and legends only.
color_percentbool | Param | None-
If true, shorthand for a transform suitable for percentages, mapping proportions in [0, 1] to [0, 100].
color_reversebool | Param | None-
Whether to reverse the scale’s encoding; equivalent to reversing either the domain or range.
color_zerobool | Param | None-
Whether the domain must include zero. If the domain minimum is positive, it will be set to zero; otherwise if the domain maximum is negative, it will be set to zero.
For quantitative scales only.
color_tick_formatstr | None | Param | None-
How to format inputs (abstract values) for axis tick labels; one of:
- a d3-format string for numeric scales
- a d3-time-format string for temporal scales
color_exponentfloat | Param | None-
A power scale’s exponent (e.g., 0.5 for sqrt); defaults to 1 for a linear scale. For pow and diverging-pow scales only.
color_basefloat | Param | None-
A log scale’s base; defaults to 10. Does not affect the scale’s encoding, but rather the default ticks. For log and diverging-log scales only.
color_constantfloat | Param | None-
A symlog scale’s constant, expressing the magnitude of the linear region around the origin; defaults to 1. For symlog and diverging-symlog scales only.
opacity_scaleContinuousScale | None | Param | None-
The opacity scale type, affecting how the scale encodes abstract data, say by applying a mathematical transformation. If null, the scale is disabled. The opacity scale defaults to linear; this scales is intended for quantitative data.
opacity_domainLiteral['fixed'] | Sequence[str | float | bool] | Param | None-
The extent of the scale’s inputs (abstract values). By default inferred from channel values. For continuous data (numbers and dates), it is typically [min, max]; it can be [max, min] to reverse the scale. For ordinal data (strings or booleans), it is an array (or iterable) of values is the desired order, defaulting to natural ascending order.
Opacity scales have a default domain from 0 to the maximum value of associated channels.
opacity_rangeSequence[str | float | bool] | Param | None-
The extent of the scale’s outputs (visual values).
Opacity scales have a default range of [0, 1].
opacity_clampbool | Param | None-
If true, values below the domain minimum are treated as the domain minimum, and values above the domain maximum are treated as the domain maximum.
Clamping is useful for focusing on a subset of the data while ensuring that extreme values remain visible, but use caution: clamped values may need an annotation to avoid misinterpretation. Clamping typically requires setting an explicit domain since if the domain is inferred, no values will be outside the domain.
For continuous scales only.
opacity_nicebool | float | Interval | Param | None-
If true, or a tick count or interval, extend the domain to nice round values. Defaults to 1, 2 or 5 times a power of 10 for linear scales, and nice time intervals for utc and time scales. Pass an interval such as minute, wednesday or month to specify what constitutes a nice interval.
For continuous scales only.
opacity_labelstr | None | Param | None-
A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value.
For axes and legends only.
opacity_percentbool | Param | None-
If true, shorthand for a transform suitable for percentages, mapping proportions in [0, 1] to [0, 100].
opacity_reversebool | Param | None-
Whether to reverse the scale’s encoding; equivalent to reversing either the domain or range.
opacity_zerobool | Param | None-
Whether the domain must include zero. If the domain minimum is positive, it will be set to zero; otherwise if the domain maximum is negative, it will be set to zero.
For quantitative scales only.
opacity_tick_formatstr | None | Param | None-
How to format inputs (abstract values) for axis tick labels; one of:
- a d3-format string for numeric scales
- a d3-time-format string for temporal scales
opacity_exponentfloat | Param | None-
A power scale’s exponent (e.g., 0.5 for sqrt); defaults to 1 for a linear scale. For pow scales only.
opacity_basefloat | Param | None-
A log scale’s base; defaults to 10. Does not affect the scale’s encoding, but rather the default ticks. For log scales only.
opacity_constantfloat | Param | None-
A symlog scale’s constant, expressing the magnitude of the linear region around the origin; defaults to 1. For symlog scales only.
symbol_scaleLiteral['ordinal', 'categorical', 'threshold', 'quantile', 'quantize'] | None | Param-
The symbol scale type, affecting how the scale encodes abstract data, say by applying a mathematical transformation. If null, the scale is disabled. Defaults to an ordinal scale type.
symbol_domainLiteral['fixed'] | Sequence[str | float | bool] | Param | None-
The extent of the scale’s inputs (abstract values). By default inferred from channel values. As symbol scales are discrete, the domain is an array (or iterable) of values is the desired order, defaulting to natural ascending order.
symbol_rangeSequence[str | float | bool] | Param | None-
The extent of the scale’s outputs (visual values). By default inferred from the scale’s type and domain, and for position scales, the plot’s dimensions. For continuous data (numbers and dates), and for ordinal position scales (point and band), it is typically [min, max]; it can be [max, min] to reverse the scale. For other ordinal data, such as for a color scale, it is an array (or iterable) of output values in the same order as the domain.
Symbol scales have a default range of categorical symbols; the choice of symbols depends on whether the associated dot mark is filled or stroked.
r_scaleContinuousScale | None | Param | None-
The r (radius) scale type, affecting how the scale encodes abstract data, say by applying a mathematical transformation. If null, the scale is disabled. The radius scale defaults to sqrt; this scale is intended for quantitative data.
r_domainLiteral['fixed'] | Sequence[str | float | bool] | Param | None-
The extent of the scale’s inputs (abstract values). By default inferred from channel values. For continuous data (numbers and dates), it is typically [min, max]; it can be [max, min] to reverse the scale. For ordinal data (strings or booleans), it is an array (or iterable) of values is the desired order, defaulting to natural ascending order.
Radius scales have a default domain from 0 to the median first quartile of associated channels.
r_rangeSequence[str | float | bool] | Param | None-
The extent of the scale’s outputs (visual values). By default inferred from the scale’s type and domain, and for position scales, the plot’s dimensions. For continuous data (numbers and dates), and for ordinal position scales (point and band), it is typically [min, max]; it can be [max, min] to reverse the scale. For other ordinal data, such as for a color scale, it is an array (or iterable) of output values in the same order as the domain.
Radius scales have a default range of [0, 3].
r_clampAny | None-
If true, values below the domain minimum are treated as the domain minimum, and values above the domain maximum are treated as the domain maximum.
Clamping is useful for focusing on a subset of the data while ensuring that extreme values remain visible, but use caution: clamped values may need an annotation to avoid misinterpretation. Clamping typically requires setting an explicit domain since if the domain is inferred, no values will be outside the domain.
For continuous scales only.
r_nicebool | float | Interval | Param | None-
If true, or a tick count or interval, extend the domain to nice round values. Defaults to 1, 2 or 5 times a power of 10 for linear scales, and nice time intervals for utc and time scales. Pass an interval such as minute, wednesday or month to specify what constitutes a nice interval.
For continuous scales only.
r_labelstr | None | Param | None-
A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value.
r_percentbool | Param | None-
If true, shorthand for a transform suitable for percentages, mapping proportions in [0, 1] to [0, 100].
r_zerobool | Param | None-
Whether the domain must include zero. If the domain minimum is positive, it will be set to zero; otherwise if the domain maximum is negative, it will be set to zero.
For quantitative scales only.
r_exponentfloat | Param | None-
A power scale’s exponent (e.g., 0.5 for sqrt); defaults to 1 for a linear scale. For pow scales only.
r_basefloat | Param | None-
A log scale’s base; defaults to 10. Does not affect the scale’s encoding, but rather the default ticks. For log scales only.
r_constantfloat | Param | None-
A symlog scale’s constant, expressing the magnitude of the linear region around the origin; defaults to 1. For symlog scales only.
length_scaleContinuousScale | None | Param | None-
The length scale type, affecting how the scale encodes abstract data, say by applying a mathematical transformation. If null, the scale is disabled. The length scale defaults to linear, as this scale is intended for quantitative data.
length_domainLiteral['fixed'] | Sequence[str | float | bool] | Param | None-
The extent of the scale’s inputs (abstract values). By default inferred from channel values. For continuous data (numbers and dates), it is typically [min, max]; it can be [max, min] to reverse the scale. For ordinal data (strings or booleans), it is an array (or iterable) of values is the desired order, defaulting to natural ascending order.
Linear scales have a default domain of [0, 1]. Log scales have a default domain of [1, 10] and cannot include zero. Radius scales have a default domain from 0 to the median first quartile of associated channels. Length have a default domain from 0 to the median median of associated channels. Opacity scales have a default domain from 0 to the maximum value of associated channels.
length_rangeSequence[str | float | bool] | Param | None-
The extent of the scale’s outputs (visual values). By default inferred from the scale’s type and domain, and for position scales, the plot’s dimensions. For continuous data (numbers and dates), and for ordinal position scales (point and band), it is typically [min, max]; it can be [max, min] to reverse the scale. For other ordinal data, such as for a color scale, it is an array (or iterable) of output values in the same order as the domain.
Length scales have a default range of [0, 12].
length_clampAny | None-
If true, values below the domain minimum are treated as the domain minimum, and values above the domain maximum are treated as the domain maximum.
Clamping is useful for focusing on a subset of the data while ensuring that extreme values remain visible, but use caution: clamped values may need an annotation to avoid misinterpretation. Clamping typically requires setting an explicit domain since if the domain is inferred, no values will be outside the domain.
For continuous scales only.
length_nicebool | float | Interval | Param | None-
If true, or a tick count or interval, extend the domain to nice round values. Defaults to 1, 2 or 5 times a power of 10 for linear scales, and nice time intervals for utc and time scales. Pass an interval such as minute, wednesday or month to specify what constitutes a nice interval.
For continuous scales only.
length_percentbool | Param | None-
If true, shorthand for a transform suitable for percentages, mapping proportions in [0, 1] to [0, 100].
length_zerobool | Param | None-
Whether the domain must include zero. If the domain minimum is positive, it will be set to zero; otherwise if the domain maximum is negative, it will be set to zero.
For quantitative scales only.
length_exponentfloat | Param | None-
A power scale’s exponent (e.g., 0.5 for sqrt); defaults to 1 for a linear scale. For pow scales only.
length_basefloat | Param | None-
A log scale’s base; defaults to 10. Does not affect the scale’s encoding, but rather the default ticks. For log scales only.
length_constantfloat | Param | None-
A symlog scale’s constant, expressing the magnitude of the linear region around the origin; defaults to 1. For symlog scales only.
projection_typeProjection | None | Param | None-
The desired projection; one of:
- a named built-in projection such as albers-usa
- null, for no projection
Named projections are scaled and translated to fit the domain to the plot’s frame (minus insets).
projection_domainobject | Param | None-
A GeoJSON object to fit to the plot’s frame (minus insets); defaults to a Sphere for spherical projections (outline of the the whole globe).
projection_rotateSequence[float | Param] | Param | None-
A rotation of the sphere before projection; defaults to [0, 0, 0]. Specified as Euler angles λ (yaw, or reference longitude), φ (pitch, or reference latitude), and optionally γ (roll), in degrees.
projection_parallelsSequence[float | Param] | Param | None-
The standard parallels. For conic projections only.
projection_precisionfloat | Param | None-
The projection’s sampling threshold.
projection_clipbool | float | Literal['frame'] | None | Param | None-
The projection’s clipping method; one of:
- frame or true (default) - clip to the plot’s frame (including margins but not insets)
- a number - clip to a circle of the given radius in degrees centered around the origin
- null or false - do not clip
Some projections (such as armadillo and berghaus) require spherical clipping: in that case set the marks’ clip option to sphere.
projection_insetfloat | Param | None-
Shorthand to set the same default for all four projection insets. All insets typically default to zero, though not always. A positive inset reduces effective area, while a negative inset increases it.
projection_inset_topfloat | Param | None-
Insets the top edge of the projection by the specified number of pixels. A positive value insets towards the bottom edge (reducing effective area), while a negative value insets away from the bottom edge (increasing it).
projection_inset_rightfloat | Param | None-
Insets the right edge of the projection by the specified number of pixels. A positive value insets towards the left edge (reducing effective area), while a negative value insets away from the left edge (increasing it).
projection_inset_bottomfloat | Param | None-
Insets the bottom edge of the projection by the specified number of pixels. A positive value insets towards the top edge (reducing effective area), while a negative value insets away from the top edge (increasing it).
projection_inset_leftfloat | Param | None-
Insets the left edge of the projection by the specified number of pixels. A positive value insets towards the right edge (reducing effective area), while a negative value insets away from the right edge (increasing it).
Legend
legend
Create a legend.
def legend(
legend: Literal["color", "opacity", "symbol"],
*,
columns: Literal["auto"] | int | None = "auto",
label: str | None = None,
target: Selection | None = None,
field: str | None = None,
width: float | None = None,
height: float | None = None,
tick_size: float | None = None,
margin_bottom: float | None = None,
margin_left: float | None = None,
margin_right: float | None = None,
margin_top: float | None = None,
for_plot: str | None = None,
frame_anchor: FrameAnchor | None = None,
inset: float | None = None,
inset_x: float | None = None,
inset_y: float | None = None,
border: str | bool = True,
background: str | bool = True,
) -> LegendlegendLiteral['color', 'opacity', 'symbol']-
Legend type (
"color","opacity", or"symbol"). columnsLiteral['auto'] | int | None-
The number of columns to use to layout a discrete legend (defaults to “auto”, which uses 1 column for location “left” or “right”)
labelstr | None-
The legend label.
targetSelection | None-
The target selection. If specified, the legend is interactive, using a
toggleinteraction for discrete legends or anintervalXinteraction for continuous legends. fieldstr | None-
The data field over which to generate output selection clauses. If unspecified, a matching field is retrieved from existing plot marks.
widthfloat | None-
Width of the legend in pixels.
heightfloat | None-
Height of the legend in pixels.
tick_sizefloat | None-
The size of legend ticks in a continuous legend, in pixels.
margin_bottomfloat | None-
The bottom margin of the legend component, in pixels.
margin_leftfloat | None-
The left margin of the legend component, in pixels.
margin_rightfloat | None-
The right margin of the legend component, in pixels.
margin_topfloat | None-
The top margin of the legend component, in pixels.
for_plotstr | None-
The name of the plot this legend applies to. A plot must include a
nameattribute to be referenced. Note that this is not use when passing a legend to the plot() function. frame_anchorFrameAnchor | None-
Where to position the relative the plot frame. Defaults to “right”.
insetfloat | None-
The inset of the legend from the plot frame, in pixels. If no inset is specified, the legend will be positioned outside the plot frame.
inset_xfloat | None-
The horizontal inset of the legend from the plot frame, in pixels.
inset_yfloat | None-
The vertical inset of the legend from the plot frame, in pixels.
borderstr | bool-
The border color for the legend. Pass ‘True’ to use the default border color, or a string to specify a custom color. Pass ‘False’ to disable the border. Defaults to
True. backgroundstr | bool-
The background color for the legend. Pass ‘True’ to use the default background color, or a string to specify a custom color. Pass ‘False’ to disable the background. Defaults to
True.
Legend
Plot legend (create legends using the legend() function).
class Legend(Component)Attributes
frame_anchorFrameAnchor-
The frame anchor for the legend.
Export
to_html
Genreate an HTML snippet for a plot or other component.
def to_html(component: Component, dependencies: bool = True) -> strcomponentComponent-
Compontent to export.
dependenciesbool-
Include JavaScript dependencies required for Jupyter widget rendering. Dependencies should only be included once per web-page, so if you already have them on a page you might want to disable including them when generating HTML.
write_html
Write an HTML file for a plot or other component.
def write_html(
file: str | Path, component: Component, dependencies: bool = True
) -> Nonefilestr | Path-
Target filename.
componentComponent-
Compontent to export.
dependenciesbool-
Include JavaScript dependencies required for Jupyter widget rendering. Dependencies should only be included once per web-page, so if you already have them on a page you might want to disable including them when generating HTML.
write_png
Export a plot or table to a PNG.
def write_png(
file: str | Path | None, component: Component, scale: int = 2, padding: int = 8
) -> tuple[bytes, int, int] | tuple[int, int] | Nonefilestr | Path | None-
Target filename (pass
Noneto return the image as bytes) componentComponent-
Component to export.
scaleint-
Device scale to capture plot at. Use 2 (the default) for retina quality images suitable for high resolution displays or print output)
paddingint-
Padding (in pixels) around plot.
Defaults
plot_defaults
Set global plot defaults.
Note that this function should be called once at the outset (subsequent calls to it do not reset the defaults).
def plot_defaults(**defaults: Unpack[PlotDefaults]) -> None**defaultsUnpack[PlotDefaults]-
Keyword args from PlotDefaults
PlotDefaults
Default options for plots.
Use the plot_defaults() function to set global defaults for plot options.
class PlotDefaults(PlotAttributes, total=False)Attributes
x_labelstr | Param-
A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value.
fx_labelstr | Param-
A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value.For axes and legends only.
y_labelstr | Param-
A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value.
fy_labelstr | Param-
A textual label to show on the axis or legend; if null, show no label. By default the scale label is inferred from channel definitions, possibly with an arrow (↑, →, ↓, or ←) to indicate the direction of increasing value.For axes and legends only.
widthfloat | Param-
The outer width of the plot in pixels, including margins. Defaults to 640.
heightfloat | Param-
The outer height of the plot in pixels, including margins. The default depends on the plot’s scales, and the plot’s width if an aspectRatio is specified. For example, if the y scale is linear and there is no fy scale, it might be 396.
Types
PositionScale
How a scale encodes abstract data, say by applying a mathematical transformation.
PositionScale: TypeAlias = Literal[
"linear",
"log",
"pow",
"sqrt",
"symlog",
"utc",
"time",
"point",
"band",
"ordinal",
"threshold",
"quantile",
"quantize",
"identity",
]Projection
Built-in projection types.
Named projections are scaled and translated to fit the domain to the plot’s frame (minus insets).
Projection: TypeAlias = Literal[
"albers",
"albers-usa",
"azimuthal-equal-area",
"azimuthal-equidistant",
"conic-conformal",
"conic-equal-area",
"conic-equidistant",
"equal-earth",
"equirectangular",
"gnomonic",
"identity",
"mercator",
"natural-earth1",
"orthographic",
"stereographic",
"transverse-mercator",
]ContinuousScale
Continuous scaling transformations.
ContinuousScale: TypeAlias = Literal[
"linear",
"log",
"pow",
"sqrt",
"symlog",
"utc",
"time",
"identity",
]ColorScale
Color scale tranformations.
ColorScale: TypeAlias = Literal[
"linear",
"log",
"pow",
"sqrt",
"symlog",
"utc",
"time",
"ordinal",
"categorical",
"threshold",
"quantile",
"quantize",
"diverging",
"diverging-log",
"diverging-pow",
"diverging-symlog",
"cyclical",
"sequential",
"rainbow",
"sinebow",
]ColorScheme
Color schemes.
ColorScheme: TypeAlias = Literal[
"accent",
"blues",
"brbg",
"bugn",
"bupu",
"category10",
"dark2",
"gnbu",
"greens",
"greys",
"magma",
"oranges",
"orrd",
"paired",
"pastel1",
"pastel2",
"piyg",
"plasma",
"prgn",
"pubu",
"pubugn",
"puor",
"purd",
"purples",
"rdbu",
"rdgy",
"rdpu",
"rdylbu",
"rdylgn",
"reds",
"set1",
"set2",
"set3",
"spectral",
"tableau10",
"turbo",
"viridis",
"warm",
"cool",
"cubehelix",
"rainbow",
"sinebow",
]Interpolate
How to interpolate color range values.
Interpolate: TypeAlias = Literal[
"rgb",
"hsl",
"lab",
"hcl",
"cubehelix",
]LabelArrow
Whether to apply a directional arrow to an axis scale label.
LabelArrow = (
Literal[
"auto",
"up",
"right",
"down",
"left",
"none",
]
| bool
| None
)