inspect_viz.interactor

Selection

interval_x

Select a continuous 1D interval selection over the x scale domain.

def interval_x(
    target: Selection,
    field: str | None = None,
    pixel_size: float | None = None,
    peers: bool | None = None,
    brush: Brush | None = None,
) -> Interactor
target Selection

The target selection. A clause of the form field BETWEEN lo AND hi is added for the currently selected interval [lo, hi].

field str | None

The name of the field (database column) over which the interval selection should be defined. If unspecified, the channel field of the first valid prior mark definition is used.

pixel_size float | None

The size of an interative pixel (default 1). Larger pixel sizes reduce the brush resolution, which can reduce the size of pre-aggregated materialized views.

peers bool | None

A flag indicating if peer (sibling) marks are excluded when cross-filtering (default true). If set, peer marks will not be filtered by this interactor’s selection in cross-filtering setups.

brush Brush | None

CSS styles for the brush (SVG rect) element.

interval_y

Select a continuous 1D interval selection over the y scale domain.

def interval_y(
    target: Selection,
    field: str | None = None,
    pixel_size: float | None = None,
    peers: bool | None = None,
    brush: Brush | None = None,
) -> Interactor
target Selection

The target selection. A clause of the form field BETWEEN lo AND hi is added for the currently selected interval [lo, hi].

field str | None

The name of the field (database column) over which the interval selection should be defined. If unspecified, the channel field of the first valid prior mark definition is used.

pixel_size float | None

The size of an interative pixel (default 1). Larger pixel sizes reduce the brush resolution, which can reduce the size of pre-aggregated materialized views.

peers bool | None

A flag indicating if peer (sibling) marks are excluded when cross-filtering (default true). If set, peer marks will not be filtered by this interactor’s selection in cross-filtering setups.

brush Brush | None

CSS styles for the brush (SVG rect) element.

interval_xy

Select a continuous 2D interval selection over the x and y scale domains.

def interval_xy(
    target: Selection,
    xfield: str | None = None,
    yfield: str | None = None,
    pixel_size: float | None = None,
    peers: bool | None = None,
    brush: Brush | None = None,
) -> Interactor
target Selection

The target selection. A clause of the form (xfield BETWEEN x1 AND x2) AND (yfield BETWEEN y1 AND y2) is added for the currently selected intervals.

xfield str | None

The name of the field (database column) over which the x-component of the interval selection should be defined. If unspecified, the x channel field of the first valid prior mark definition is used.

yfield str | None

The name of the field (database column) over which the y-component of the interval selection should be defined. If unspecified, the y channel field of the first valid prior mark definition is used.

pixel_size float | None

The size of an interative pixel (default 1). Larger pixel sizes reduce the brush resolution, which can reduce the size of pre-aggregated materialized views.

peers bool | None

A flag indicating if peer (sibling) marks are excluded when cross-filtering (default true). If set, peer marks will not be filtered by this interactor’s selection in cross-filtering setups.

brush Brush | None

CSS styles for the brush (SVG rect) element.

nearest_x

Select values from the mark closest to the pointer x location.

def nearest_x(
    target: Selection,
    channels: list[str] | None = None,
    fields: list[str] | None = None,
    max_radius: float | None = None,
) -> Interactor
target Selection

The target selection. A clause of the form field = value is added for the currently nearest value.

channels list[str] | None

The encoding channels whose domain values should be selected. For example, a setting of ['color'] selects the data value backing the color channel, whereas ['x', 'z'] selects both x and z channel domain values. If unspecified, the selected channels default to match the current pointer settings: a nearestX interactor selects the ['x'] channels, while a nearest interactor selects the ['x', 'y'] channels.

fields list[str] | None

The fields (database column names) to use in generated selection clause predicates. If unspecified, the fields backing the selected channels in the first valid prior mark definition are used by default.

max_radius float | None

The maximum radius of a nearest selection (default 40). Marks with (x, y) coordinates outside this radius will not be selected as nearest points.

nearest_y

Select values from the mark closest to the pointer y location.

def nearest_y(
    target: Selection,
    channels: list[str] | None = None,
    fields: list[str] | None = None,
    max_radius: float | None = None,
) -> Interactor
target Selection

The target selection. A clause of the form field = value is added for the currently nearest value.

channels list[str] | None

The encoding channels whose domain values should be selected. For example, a setting of ['color'] selects the data value backing the color channel, whereas ['x', 'z'] selects both x and z channel domain values. If unspecified, the selected channels default to match the current pointer settings: a nearestX interactor selects the ['x'] channels, while a nearest interactor selects the ['x', 'y'] channels.

fields list[str] | None

The fields (database column names) to use in generated selection clause predicates. If unspecified, the fields backing the selected channels in the first valid prior mark definition are used by default.

max_radius float | None

The maximum radius of a nearest selection (default 40). Marks with (x, y) coordinates outside this radius will not be selected as nearest points.

toggle

Select individal values.

def toggle(
    target: Selection,
    channels: list[str],
    peers: bool | None = None,
) -> Interactor
target Selection

The target selection. A clause of the form (field = value1) OR (field = value2) ... is added for the currently selected values.

channels list[str]

The encoding channels over which to select values. For a selected mark, selection clauses will cover the backing data fields for each channel.

peers bool | None

A flag indicating if peer (sibling) marks are excluded when cross-filtering (default true). If set, peer marks will not be filtered by this interactor’s selection in cross-filtering setups.

toggle_x

Select individal values in the x scale domain. Clicking or touching a mark toggles its selection status.

def toggle_x(
    target: Selection,
    peers: bool | None = None,
) -> Interactor
target Selection

The target selection. A clause of the form (field = value1) OR (field = value2) ... is added for the currently selected values.

peers bool | None

A flag indicating if peer (sibling) marks are excluded when cross-filtering (default true). If set, peer marks will not be filtered by this interactor’s selection in cross-filtering setups.

toggle_y

Toggle interactor over the "y" encoding channel only.

def toggle_y(
    target: Selection,
    peers: bool | None = None,
) -> Interactor
target Selection

The target selection. A clause of the form (field = value1) OR (field = value2) ... is added for the currently selected values.

peers bool | None

A flag indicating if peer (sibling) marks are excluded when cross-filtering (default true). If set, peer marks will not be filtered by this interactor’s selection in cross-filtering setups.

toggle_color

Select individal values in the color scale domain. Clicking or touching a mark toggles its selection status.

def toggle_color(
    target: Selection,
    peers: bool | None = None,
) -> Interactor
target Selection

The target selection. A clause of the form (field = value1) OR (field = value2) ... is added for the currently selected values.

peers bool | None

A flag indicating if peer (sibling) marks are excluded when cross-filtering (default true). If set, peer marks will not be filtered by this interactor’s selection in cross-filtering setups.

region

Select aspects of individual marks within a 2D range.

def region(
    target: Selection,
    channels: list[str],
    peers: bool | None = None,
    brush: Brush | None = None,
) -> Interactor
target Selection

The target selection. A clause of the form (field = value1) OR (field = value2) ... is added for the currently selected values.

channels list[str]

The encoding channels over which to select values (e.g. “x”, “y”, “color”, etc.). For a selected mark, selection clauses will cover the backing data fields for each channel.

peers bool | None

A flag indicating if peer (sibling) marks are excluded when cross-filtering (default true). If set, peer marks will not be filtered by this interactor’s selection in cross-filtering setups.

brush Brush | None

CSS styles for the brush (SVG rect) element.

highlight

Highlight individual visualized data points based on a Selection.

Selected values keep their normal appearance. Unselected values are deemphasized.

def highlight(
    by: Selection,
    opacity: float | None = None,
    fill_opacity: float | None = None,
    stroke_opacity: float | None = None,
    fill: str | None = None,
    stroke: str | None = None,
) -> Interactor
by Selection

The input selection. Unselected marks are deemphasized.

opacity float | None

The overall opacity of deemphasized marks. By default the opacity is set to 0.2.

fill_opacity float | None

The fill opacity of deemphasized marks. By default the fill opacity is unchanged.

stroke_opacity float | None

The stroke opacity of deemphasized marks. By default the stroke opacity is unchanged.

fill str | None

The fill color of deemphasized marks. By default the fill is unchanged.

stroke str | None

The stroke color of deemphasized marks. By default the stroke is unchanged.

Types

Interactor

Interactors imbue plots with interactive behavior, such as selecting or highlighting values, and panning or zooming the display.

class Interactor(Component)

Brush

Brush options.

class Brush(TypedDict, total=False)

Attributes

fill str

The fill color of the brush rectangle.

fill_opacity float

The fill opacity of the brush rectangle.

opacity float

The overall opacity of the brush rectangle.

stroke str

The stroke color of the brush rectangle.

stroke_dasharray str

The stroke dash array of the brush rectangle.

stroke_opacity float

The stroke opacity of the brush rectangle.