whitecanvas.layers.primitive package

Submodules

whitecanvas.layers.primitive.band module

class whitecanvas.layers.primitive.band.Band(t: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], edge_low: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], edge_high: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, *, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1.0, pattern: str | whitecanvas.types._enums.FacePattern = FacePattern.SOLID, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers._mixin.FaceEdgeMixin[whitecanvas.protocols.layer_protocols.BandProtocol]

property data: whitecanvas.types._tuples.XYYData

Current data of the layer.

property orient: whitecanvas.types._enums.Orientation

Orientation of the band.

set_data(t: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None, edge_low: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None, edge_high: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None)[source]

whitecanvas.layers.primitive.bars module

class whitecanvas.layers.primitive.bars.Bars(x: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], height: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], bottom: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None, *, orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, bar_width: float = 0.8, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1.0, pattern: str | whitecanvas.types._enums.FacePattern = FacePattern.SOLID, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers._mixin.MultiFaceEdgeMixin[whitecanvas.protocols.layer_protocols.BarProtocol, whitecanvas.layers.primitive.bars._Face, whitecanvas.layers.primitive.bars._Edge]

property bar_width: float

Width of the bars.

property bottom: numpy.ndarray[Any, numpy.dtype[numpy.floating]]
property data: whitecanvas.types._tuples.XYData

Current data of the layer.

classmethod from_histogram(data: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], *, bins: Union[int, Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]] = 10, density: bool = False, range: tuple[float, float] | None = None, orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, bar_width: float | None = None, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1.0, pattern: str | whitecanvas.types._enums.FacePattern = FacePattern.SOLID, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Construct a bar plot from a histogram.

property ndata: int

The number of data points

property orient: whitecanvas.types._enums.Orientation

Orientation of the bars.

set_data(xdata: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None, ydata: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None, bottom: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None)[source]
property top: numpy.ndarray[Any, numpy.dtype[numpy.floating]]
with_edge(color: Optional[Union[str, Iterable[int | float], cmap._color.Color]] = None, width: float = 1, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, alpha: float = 1) whitecanvas.layers.primitive.bars.Bars[whitecanvas.layers.primitive.bars._Face, whitecanvas.layers._mixin.ConstEdge][source]

Update the edge properties.

with_edge_multi(color: Optional[Union[str, Iterable[int | float], cmap._color.Color, Sequence[Union[str, Iterable[int | float], cmap._color.Color]]]] = None, width: Union[float, Sequence[float]] = 1, style: str | whitecanvas.types._enums.LineStyle | list[str | whitecanvas.types._enums.LineStyle] = LineStyle.SOLID, alpha: float = 1) whitecanvas.layers.primitive.bars.Bars[whitecanvas.layers.primitive.bars._Face, whitecanvas.layers._mixin.MultiEdge][source]

Update the edge properties.

with_err(err: ArrayLike1D, err_high: ArrayLike1D | None = None, *, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool | _Void = True, capsize: float = 0) _lg.LabeledBars[source]
with_face(color: Optional[Union[str, Iterable[int | float], cmap._color.Color]] = None, pattern: whitecanvas.types._enums.FacePattern | str = FacePattern.SOLID, alpha: float = 1) whitecanvas.layers.primitive.bars.Bars[whitecanvas.layers._mixin.ConstFace, whitecanvas.layers.primitive.bars._Edge][source]

Update the face properties.

with_face_multi(color: Optional[Union[str, Iterable[int | float], cmap._color.Color, Sequence[Union[str, Iterable[int | float], cmap._color.Color]]]] = None, pattern: Union[str, whitecanvas.types._enums.FacePattern, Sequence[str | whitecanvas.types._enums.FacePattern]] = FacePattern.SOLID, alpha: float = 1) whitecanvas.layers.primitive.bars.Bars[whitecanvas.layers._mixin.MultiFace, whitecanvas.layers.primitive.bars._Edge][source]
with_text(strings: list[str], *, color: ColorType = 'black', size: float = 12, rotation: float = 0.0, anchor: str | Alignment = Alignment.BOTTOM_LEFT, fontfamily: str | None = None) _lg.LabeledBars[source]
with_xerr(err: ArrayLike1D, err_high: ArrayLike1D | None = None, *, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool | _Void = True, capsize: float = 0) _lg.LabeledBars[source]
with_yerr(err: ArrayLike1D, err_high: ArrayLike1D | None = None, *, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool = True, capsize: float = 0) _lg.LabeledBars[source]

whitecanvas.layers.primitive.errorbars module

class whitecanvas.layers.primitive.errorbars.Errorbars(t: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], edge_low: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], edge_high: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, *, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'black', alpha: float = 1, width: float = 1, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, antialias: bool = True, capsize: float = 0.0, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers.primitive.line.MultiLine

Errorbars layer (parallel lines with caps).

property antialias: bool

Whether to use antialiasing.

property capsize: float

Size of the cap of the line edges.

property data: whitecanvas.types._tuples.XYYData

Current data of the layer.

classmethod empty(orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, backend: whitecanvas.backend._instance.Backend | str | None = None) whitecanvas.layers.primitive.errorbars.Errorbars[source]

Return an Errorbars instance with no component.

property ndata: int

Number of data points.

property orient: whitecanvas.types._enums.Orientation

Orientation of the error bars.

set_data(t: Optional[Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]] = None, edge_low: Optional[Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]] = None, edge_high: Optional[Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]] = None)[source]
update(color: typing.Union[str, typing.Iterable[int | float], cmap._color.Color, whitecanvas.types._alias._Void] = <whitecanvas.types._alias._Void object>, width: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, style: str | whitecanvas.types._enums.LineStyle | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, alpha: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, antialias: bool | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, capsize: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>)[source]

whitecanvas.layers.primitive.image module

class whitecanvas.layers.primitive.image.Image(image: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], *, name: str | None = None, cmap: Union[str, cmap._colormap.Colormap, Any] = 'gray', clim: tuple[float | None, float | None] | None = None, shift: tuple[float, float] = (0, 0), scale: tuple[float, float] = (1.0, 1.0), backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers._base.PrimitiveLayer[whitecanvas.protocols.layer_protocols.ImageProtocol]

Grayscale or RGBA image layer.

Parameters
  • image (array_like) – 2D or 3D array of image data.

  • cmap (colormap type, default is "gray") – Colormap to use.

  • clim (tuple of float or None, optional) – Contrast limits. If None, the limits are set to the min and max of the data. You can also pass None separately to either limit to only autoscale one of them.

property clim: tuple[float, float]

Current contrast limits.

property cmap: cmap._colormap.Colormap

Current colormap.

property data: numpy.ndarray[Any, numpy.dtype[numpy.number]]

Current data of the layer.

fit_to(bbox: tuple[float, float, float, float]) whitecanvas.layers.primitive.image.Image[source]

Fit the image to the given bounding box.

property is_rgba: bool

Whether the image is RGBA.

property scale: tuple[float, float]

Current scale.

property shift: tuple[float, float]

Current shift from the origin.

update(*, cmap: ColormapType | _void = <whitecanvas.types._alias._Void object>, clim: tuple[float | None, float | None] | None | _Void = <whitecanvas.types._alias._Void object>, shift: tuple[float, float] | _void = <whitecanvas.types._alias._Void object>, scale: tuple[float, float] | _void = <whitecanvas.types._alias._Void object>) Image[source]

whitecanvas.layers.primitive.inf_curve module

class whitecanvas.layers.primitive.inf_curve.InfCurve(model: Callable[[Concatenate[numpy.ndarray, _P]], numpy.ndarray], *, bounds: tuple[float, float] = (- inf, inf), name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1, width: float = 1, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, antialias: bool = True, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers.primitive.line.MonoLine, Generic[whitecanvas.layers.primitive.inf_curve._P]

property data: NoReturn
property model: Callable[[numpy.ndarray], numpy.ndarray]

The model function of the layer.

set_data(xdata=None, ydata=None) NoReturn[source]
with_params(*args: typing.~_P, **kwargs: typing.~_P) None[source]

Set the parameters of the model function.

class whitecanvas.layers.primitive.inf_curve.InfLine(pos: tuple[float, float] = (0, 0), angle: float = 0.0, *, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1, width: float = 1, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, antialias: bool = True, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers.primitive.line.MonoLine

property data: NoReturn
property pos: tuple[float, float]

One of the points on the line.

set_data(xdata=None, ydata=None) NoReturn[source]

whitecanvas.layers.primitive.line module

class whitecanvas.layers.primitive.line.Line(xdata: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], ydata: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], *, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', width: float = 1, alpha: float = 1.0, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, antialias: bool = False, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers.primitive.line.MonoLine

property data: whitecanvas.types._tuples.XYData

Current data of the layer.

classmethod from_cdf(data: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], *, sorted: bool = False, orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1.0, width: float = 1.0, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Construct a line from a cumulative histogram.

classmethod from_histogram(data: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], *, bins: Union[int, Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]] = 10, density: bool = False, range: tuple[float, float] | None = None, orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1.0, width: float = 1.0, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Construct a line from a histogram.

set_data(xdata: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None, ydata: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None)[source]
with_markers(symbol: Symbol | str = Symbol.CIRCLE, size: float = 10, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, alpha: float = 1.0, pattern: str | FacePattern = FacePattern.SOLID) _lg.Plot[source]
with_text(strings: list[str], *, color: ColorType = 'black', size: float = 12, rotation: float = 0.0, anchor: str | Alignment = Alignment.BOTTOM_LEFT, fontfamily: str | None = None) _lg.LabeledLine[source]
with_xband(err: ArrayLike1D, err_high: ArrayLike1D | None = None, *, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, alpha: float = 0.5, pattern: str | FacePattern = FacePattern.SOLID) _lg.LineBand[source]
with_xerr(err: ArrayLike1D, err_high: ArrayLike1D | None = None, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool | _Void = <whitecanvas.types._alias._Void object>, capsize: float = 0) _lg.LabeledLine[source]
with_xfill(bottom: float = 0.0, *, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, alpha: float = 0.5, pattern: str | FacePattern = FacePattern.SOLID) _lg.LineBand[source]
with_yband(err: ArrayLike1D, err_high: ArrayLike1D | None = None, *, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, alpha: float = 0.5, pattern: str | FacePattern = FacePattern.SOLID) _lg.LineBand[source]
with_yerr(err: ArrayLike1D, err_high: ArrayLike1D | None = None, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool | _Void = <whitecanvas.types._alias._Void object>, capsize: float = 0) _lg.LabeledLine[source]
with_yfill(bottom: float = 0.0, *, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, alpha: float = 0.5, pattern: str | FacePattern = FacePattern.SOLID) _lg.LineBand[source]
class whitecanvas.layers.primitive.line.MonoLine(name: str | None = None)[source]

Bases: whitecanvas.layers._mixin.LineMixin[whitecanvas.protocols.layer_protocols.LineProtocol]

property antialias: bool

Whether to use antialiasing.

class whitecanvas.layers.primitive.line.MultiLine(data: list[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]], *, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', width: float = 1.0, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, antialias: bool = True, alpha: float = 1.0, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers._base.PrimitiveLayer[whitecanvas.protocols.layer_protocols.MultiLineProtocol]

property alpha: float

Alpha value of the line.

property antialias: bool

Whether to use antialiasing.

property color: numpy.ndarray[Any, numpy.dtype[numpy.floating]]

Color of the line.

property data: list[whitecanvas.types._tuples.XYData]

Current data of the layer.

property nlines: int

Number of lines.

set_data(data: list[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]])[source]
property style: whitecanvas.types._enums.LineStyle

Style of the line.

update(*, color: typing.Union[str, typing.Iterable[int | float], cmap._color.Color, whitecanvas.types._alias._Void] = <whitecanvas.types._alias._Void object>, alpha: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, width: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, style: str | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, antialias: bool | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>)[source]
property width: float

Width of the line.

whitecanvas.layers.primitive.markers module

class whitecanvas.layers.primitive.markers.Markers(xdata: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], ydata: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], *, name: str | None = None, symbol: whitecanvas.types._enums.Symbol | str = Symbol.CIRCLE, size: float = 15.0, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1.0, pattern: str | whitecanvas.types._enums.FacePattern = FacePattern.SOLID, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers._mixin.MultiFaceEdgeMixin[whitecanvas.protocols.layer_protocols.MarkersProtocol, whitecanvas.layers.primitive.markers._Face, whitecanvas.layers.primitive.markers._Edge], Generic[whitecanvas.layers.primitive.markers._Face, whitecanvas.layers.primitive.markers._Edge, whitecanvas.layers.primitive.markers._Size]

property data: whitecanvas.types._tuples.XYData

Current data of the layer.

classmethod empty(backend: Backend | str | None = None) Markers[ConstFace, ConstEdge, float][source]

Return an empty markers layer.

events: MarkersLayerEvents
property ndata: int

Number of data points.

set_data(xdata: Optional[Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]] = None, ydata: Optional[Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]] = None)[source]
property size: whitecanvas.layers.primitive.markers._Size

Size of the symbol.

property symbol: whitecanvas.types._enums.Symbol

Symbol used to mark the data points.

update(*, symbol: whitecanvas.types._enums.Symbol | str | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, size: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, color: typing.Union[str, typing.Iterable[int | float], cmap._color.Color, whitecanvas.types._alias._Void] = <whitecanvas.types._alias._Void object>, alpha: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, pattern: str | whitecanvas.types._enums.FacePattern | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>) whitecanvas.layers.primitive.markers.Markers[whitecanvas.layers.primitive.markers._Face, whitecanvas.layers.primitive.markers._Edge, whitecanvas.layers.primitive.markers._Size][source]

Update the properties of the markers.

with_edge(color: ColorType | None = None, width: float = 1.0, style: LineStyle | str = LineStyle.SOLID, alpha: float = 1.0) Markers[_Face, ConstEdge, _Size][source]

Update the edge properties.

with_edge_multi(color: ColorType | Sequence[ColorType] | None = None, width: float | Sequence[float] = 1.0, style: str | LineStyle | list[str | LineStyle] = LineStyle.SOLID, alpha: float = 1.0) Markers[_Face, MultiEdge, _Size][source]

Update the edge properties.

with_face(color: ColorType | None = None, pattern: FacePattern | str = FacePattern.SOLID, alpha: float = 1.0) Markers[ConstFace, _Edge, _Size][source]

Return a markers layer with constant face properties.

In most cases, this function is not needed because the face properties can be set directly on construction. Examples below are equivalent:

>>> markers = canvas.add_markers(x, y).with_face(color="red")
>>> markers = canvas.add_markers(x, y, color="red")

This function will be useful when you want to change the markers from multi-face state to constant-face state:

>>> markers = canvas.add_markers(x, y).with_face_multi(color=colors)
>>> markers = markers.with_face(color="red")
Parameters
  • color (color-like, optional) – Color of the marker faces.

  • pattern (str or FacePattern, optional) – Pattern (hatch) of the faces.

  • alpha (float, optional) – Alpha channel of the faces.

Returns

The updated markers layer.

Return type

Markers

with_face_multi(color: ColorType | Sequence[ColorType] | None = None, pattern: str | FacePattern | Sequence[str | FacePattern] = FacePattern.SOLID, alpha: float = 1) Markers[MultiFace, _Edge, _Size][source]

Return a markers layer with multi-face properties.

This function is used to create a markers layer with multiple face properties, such as colorful markers.

>>> markers = canvas.add_markers(x, y).with_face_multi(color=colors)
Parameters
  • color (color-like or sequence of color-like, optional) – Color(s) of the marker faces.

  • pattern (str or FacePattern or sequence of it, optional) – Pattern(s) of the faces.

  • alpha (float or sequence of float, optional) – Alpha channel(s) of the faces.

Returns

The updated markers layer.

Return type

Markers

with_hover_template(template: str, **kwargs) whitecanvas.layers.primitive.markers.Markers[whitecanvas.layers.primitive.markers._Face, whitecanvas.layers.primitive.markers._Edge, whitecanvas.layers.primitive.markers._Size][source]

Add hover template to the markers.

with_hover_text(text: Iterable[Any]) whitecanvas.layers.primitive.markers.Markers[whitecanvas.layers.primitive.markers._Face, whitecanvas.layers.primitive.markers._Edge, whitecanvas.layers.primitive.markers._Size][source]

Add hover text to the markers.

with_network(connections: NDArray[np.intp], color: ColorType | _Void = <whitecanvas.types._alias._Void object>, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool = True) _lg.Graph[source]

Add network edges to the markers to create a graph.

Parameters
  • connections ((N, 2) array of int) – Integer array that defines the connections between nodes.

  • color (color-like, optional) – Color of the lines.

  • width (float, optional) – Width of the line.

  • style (str, optional) – Line style of the line.

  • antialias (bool, optional) – Antialiasing of the line.

Returns

A Graph layer that contains the markers and the edges as children.

Return type

Graph

with_size_multi(size: Union[float, Sequence[float]]) whitecanvas.layers.primitive.markers.Markers[whitecanvas.layers.primitive.markers._Face, whitecanvas.layers.primitive.markers._Edge, numpy.ndarray[Any, numpy.dtype[numpy.float32]]][source]
with_stem(orient: str | Orientation = Orientation.VERTICAL, *, bottom: NDArray[np.floating] | float | None = None, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, alpha: float = 1.0, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool = True) _lg.StemPlot[source]

Grow stems from the markers.

Parameters
  • orient (str or Orientation, default is vertical) – Orientation to grow stems.

  • bottom (float or array-like, optional) – Bottom of the stems. If not specified, the bottom is set to 0.

  • color (color-like, optional) – Color of the lines.

  • alpha (float, optional) – Alpha channel of the lines.

  • width (float, optional) – Width of the lines.

  • style (str or LineStyle) – Line style used to draw the stems.

  • antialias (bool, optional) – Line antialiasing.

Returns

StemPlot layer containing the markers and the stems as children.

Return type

StemPlot

with_text(strings: list[str], *, color: ColorType = 'black', size: float = 12, rotation: float = 0.0, anchor: str | Alignment = Alignment.BOTTOM_LEFT, fontfamily: str | None = None) _lg.LabeledMarkers[source]
with_xerr(err: ArrayLike, err_high: ArrayLike | None = None, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool | _Void = True, capsize: float = 0) _lg.LabeledMarkers[source]

Add horizontal error bars to the markers.

Parameters
  • err (ArrayLike) – Error values. If err_high is not specified, the error bars are symmetric.

  • err_high (array-like, optional) – Upper error values.

  • color (color-like, optional) – Line color of the error bars.

  • width (float) – Width of the error bars.

  • style (str or LineStyle) – Line style of the error bars.

  • antialias (bool) – Antialiasing of the error bars.

  • capsize (float, optional) – Size of the caps at the end of the error bars.

Returns

Layer group containing the markers and the error bars as children.

Return type

LabeledMarkers

with_yerr(err: ArrayLike, err_high: ArrayLike | None = None, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool = True, capsize: float = 0) _lg.LabeledMarkers[source]

Add vertical error bars to the markers.

Parameters
  • err (ArrayLike) – Error values. If err_high is not specified, the error bars are symmetric.

  • err_high (array-like, optional) – Upper error values.

  • color (color-like, optional) – Line color of the error bars.

  • width (float) – Width of the error bars.

  • style (str or LineStyle) – Line style of the error bars.

  • antialias (bool) – Antialiasing of the error bars.

  • capsize (float, optional) – Size of the caps at the end of the error bars.

Returns

Layer group containing the markers and the error bars as children.

Return type

LabeledMarkers

class whitecanvas.layers.primitive.markers.MarkersLayerEvents[source]

Bases: whitecanvas.layers._base.LayerEvents

picked

whitecanvas.layers.primitive.rug module

class whitecanvas.layers.primitive.rug.Rug(events: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], *, low: float = 0.0, high: float = 1.0, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'black', alpha: float = 1.0, orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, backend: str | whitecanvas.backend._instance.Backend | None = None)[source]

Bases: whitecanvas.layers.primitive.line.MultiLine

Rug plot (event plot) layer.

│ ││ │ │

──┴─┴┴──┴───┴──>

property data: numpy.ndarray[Any, numpy.dtype[numpy.number]]

Current data of the layer.

property high: float
property low: float
property orient: whitecanvas.types._enums.Orientation
set_data(events: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]])[source]

whitecanvas.layers.primitive.spans module

class whitecanvas.layers.primitive.spans.Spans(spans: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], *, name: str | None = None, orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1.0, pattern: str | whitecanvas.types._enums.FacePattern = FacePattern.SOLID, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers._mixin.MultiFaceEdgeMixin[whitecanvas.protocols.layer_protocols.BarProtocol, whitecanvas.layers.primitive.spans._Face, whitecanvas.layers.primitive.spans._Edge]

Layer that represents vertical/hosizontal spans.

──────────────────────────────>

|///| |///////////| |///| |///////////|

property data: numpy.ndarray[Any, numpy.dtype[numpy.float64]]
property ndata: int

The number of data points

property orient: whitecanvas.types._enums.Orientation
set_data(spans: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]])[source]
with_edge(color: Optional[Union[str, Iterable[int | float], cmap._color.Color]] = None, width: float = 1, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, alpha: float = 1) whitecanvas.layers.primitive.spans.Spans[whitecanvas.layers.primitive.spans._Face, whitecanvas.layers._mixin.ConstEdge][source]

Update the edge properties.

with_edge_multi(color: Optional[Union[str, Iterable[int | float], cmap._color.Color, Sequence[Union[str, Iterable[int | float], cmap._color.Color]]]] = None, width: Union[float, Sequence[float]] = 1, style: str | whitecanvas.types._enums.LineStyle | list[str | whitecanvas.types._enums.LineStyle] = LineStyle.SOLID, alpha: float = 1) whitecanvas.layers.primitive.spans.Spans[whitecanvas.layers.primitive.spans._Face, whitecanvas.layers._mixin.MultiEdge][source]

Update the edge properties.

with_face(color: Optional[Union[str, Iterable[int | float], cmap._color.Color]] = None, pattern: whitecanvas.types._enums.FacePattern | str = FacePattern.SOLID, alpha: float = 1) whitecanvas.layers.primitive.spans.Spans[whitecanvas.layers._mixin.ConstFace, whitecanvas.layers.primitive.spans._Edge][source]

Update the face properties.

with_face_multi(color: Optional[Union[str, Iterable[int | float], cmap._color.Color, Sequence[Union[str, Iterable[int | float], cmap._color.Color]]]] = None, pattern: Union[str, whitecanvas.types._enums.FacePattern, Sequence[str | whitecanvas.types._enums.FacePattern]] = FacePattern.SOLID, alpha: float = 1) whitecanvas.layers.primitive.spans.Spans[whitecanvas.layers._mixin.MultiFace, whitecanvas.layers.primitive.spans._Edge][source]

whitecanvas.layers.primitive.text module

class whitecanvas.layers.primitive.text.AggTextBackgroundEdge(text_layer: whitecanvas.layers.primitive.text.Texts)[source]

Bases: whitecanvas.layers.primitive.text.TextNamespace

property alpha
property color
property style
update(color: typing.Union[str, typing.Iterable[int | float], cmap._color.Color, whitecanvas.types._alias._Void] = <whitecanvas.types._alias._Void object>, style: whitecanvas.types._enums.LineStyle | str | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, width: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, alpha: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>) whitecanvas.layers.primitive.text.Texts[source]
property width
class whitecanvas.layers.primitive.text.AggTextBackgroundFace(text_layer: whitecanvas.layers.primitive.text.Texts)[source]

Bases: whitecanvas.layers.primitive.text.TextNamespace

property alpha
property color
property pattern
update(color: typing.Union[str, typing.Iterable[int | float], cmap._color.Color, whitecanvas.types._alias._Void] = <whitecanvas.types._alias._Void object>, pattern: whitecanvas.types._enums.FacePattern | str | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, alpha: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>) whitecanvas.layers.primitive.text.Texts[source]
class whitecanvas.layers.primitive.text.HeteroText(x: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], y: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], text: Sequence[str], *, color: Union[str, Iterable[int | float], cmap._color.Color] = 'black', size: Optional[Union[float, Sequence[float]]] = None, rotation: Union[float, Sequence[float]] = 0.0, anchor: str | whitecanvas.types._enums.Alignment | list[str | whitecanvas.types._enums.Alignment] = Alignment.BOTTOM_LEFT, fontfamily: Optional[Union[str, Sequence[str]]] = None, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers.primitive.text.TextBase

property anchor: whitecanvas.types._enums.Alignment

Anchor of the text.

property color

Color of the text.

property fontfamily: str

Font family of the text.

property rotation: float

Rotation of the text.

property size

Size of the text.

update(color: typing.Union[str, typing.Iterable[int | float], cmap._color.Color, whitecanvas.types._alias._Void] = <whitecanvas.types._alias._Void object>, size: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, rotation: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, anchor: whitecanvas.types._enums.Alignment | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, fontfamily: str | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>) whitecanvas.layers.primitive.text.Texts[source]
class whitecanvas.layers.primitive.text.TextBackgroundEdge(text_layer: whitecanvas.layers.primitive.text.Texts)[source]

Bases: whitecanvas.layers.primitive.text.TextNamespace

property alpha
property color
property style
update(color: typing.Union[str, typing.Iterable[int | float], cmap._color.Color, whitecanvas.types._alias._Void] = <whitecanvas.types._alias._Void object>, style: str | whitecanvas.types._enums.LineStyle | list[str | whitecanvas.types._enums.LineStyle] | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, width: typing.Union[float, typing.Sequence[float], whitecanvas.types._alias._Void] = <whitecanvas.types._alias._Void object>, alpha: typing.Union[float, typing.Sequence[float], whitecanvas.types._alias._Void] = <whitecanvas.types._alias._Void object>) whitecanvas.layers.primitive.text.Texts[source]
property width
class whitecanvas.layers.primitive.text.TextBackgroundFace(text_layer: whitecanvas.layers.primitive.text.Texts)[source]

Bases: whitecanvas.layers.primitive.text.TextNamespace

property alpha
property color
property pattern
update(color: typing.Union[str, typing.Iterable[int | float], cmap._color.Color, whitecanvas.types._alias._Void] = <whitecanvas.types._alias._Void object>, pattern: str | whitecanvas.types._enums.FacePattern | list[str | whitecanvas.types._enums.FacePattern] | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, alpha: typing.Union[float, typing.Sequence[float], whitecanvas.types._alias._Void] = <whitecanvas.types._alias._Void object>) whitecanvas.layers.primitive.text.Texts[source]
class whitecanvas.layers.primitive.text.TextBase(name: str | None = None)[source]

Bases: whitecanvas.layers._base.PrimitiveLayer[whitecanvas.protocols.layer_protocols.TextProtocol]

property edge

Background edge of the text.

property face

Background face of the text.

property ntexts

Number of texts.

property pos: whitecanvas.types._tuples.XYData

Position of the text.

set_pos(xpos: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], ypos: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]])[source]

Set the position of the text.

property string: list[str]

Text of the text.

class whitecanvas.layers.primitive.text.TextNamespace(text_layer: whitecanvas.layers.primitive.text.Texts)[source]

Bases: object

class whitecanvas.layers.primitive.text.Texts(x: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], y: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], text: Sequence[str], *, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'black', size: float | None = None, rotation: float = 0.0, anchor: whitecanvas.types._enums.Alignment = Alignment.BOTTOM_LEFT, fontfamily: str | None = None, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers.primitive.text.TextBase

property anchor: whitecanvas.types._enums.Alignment

Anchor of the text.

property color

Color of the text.

property fontfamily: str

Font family of the text.

property rotation: float

Rotation of the text.

property size

Size of the text.

update(color: typing.Union[str, typing.Iterable[int | float], cmap._color.Color, whitecanvas.types._alias._Void] = <whitecanvas.types._alias._Void object>, size: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, rotation: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, anchor: whitecanvas.types._enums.Alignment | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, fontfamily: str | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>) whitecanvas.layers.primitive.text.Texts[source]

Module contents

class whitecanvas.layers.primitive.Band(t: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], edge_low: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], edge_high: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, *, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1.0, pattern: str | whitecanvas.types._enums.FacePattern = FacePattern.SOLID, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers._mixin.FaceEdgeMixin[whitecanvas.protocols.layer_protocols.BandProtocol]

property data: whitecanvas.types._tuples.XYYData

Current data of the layer.

property orient: whitecanvas.types._enums.Orientation

Orientation of the band.

set_data(t: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None, edge_low: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None, edge_high: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None)[source]
class whitecanvas.layers.primitive.Bars(x: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], height: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], bottom: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None, *, orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, bar_width: float = 0.8, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1.0, pattern: str | whitecanvas.types._enums.FacePattern = FacePattern.SOLID, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers._mixin.MultiFaceEdgeMixin[whitecanvas.protocols.layer_protocols.BarProtocol, whitecanvas.layers.primitive.bars._Face, whitecanvas.layers.primitive.bars._Edge]

property bar_width: float

Width of the bars.

property bottom: numpy.ndarray[Any, numpy.dtype[numpy.floating]]
property data: whitecanvas.types._tuples.XYData

Current data of the layer.

classmethod from_histogram(data: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], *, bins: Union[int, Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]] = 10, density: bool = False, range: tuple[float, float] | None = None, orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, bar_width: float | None = None, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1.0, pattern: str | whitecanvas.types._enums.FacePattern = FacePattern.SOLID, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Construct a bar plot from a histogram.

property ndata: int

The number of data points

property orient: whitecanvas.types._enums.Orientation

Orientation of the bars.

set_data(xdata: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None, ydata: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None, bottom: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None)[source]
property top: numpy.ndarray[Any, numpy.dtype[numpy.floating]]
with_edge(color: Optional[Union[str, Iterable[int | float], cmap._color.Color]] = None, width: float = 1, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, alpha: float = 1) whitecanvas.layers.primitive.bars.Bars[whitecanvas.layers.primitive.bars._Face, whitecanvas.layers._mixin.ConstEdge][source]

Update the edge properties.

with_edge_multi(color: Optional[Union[str, Iterable[int | float], cmap._color.Color, Sequence[Union[str, Iterable[int | float], cmap._color.Color]]]] = None, width: Union[float, Sequence[float]] = 1, style: str | whitecanvas.types._enums.LineStyle | list[str | whitecanvas.types._enums.LineStyle] = LineStyle.SOLID, alpha: float = 1) whitecanvas.layers.primitive.bars.Bars[whitecanvas.layers.primitive.bars._Face, whitecanvas.layers._mixin.MultiEdge][source]

Update the edge properties.

with_err(err: ArrayLike1D, err_high: ArrayLike1D | None = None, *, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool | _Void = True, capsize: float = 0) _lg.LabeledBars[source]
with_face(color: Optional[Union[str, Iterable[int | float], cmap._color.Color]] = None, pattern: whitecanvas.types._enums.FacePattern | str = FacePattern.SOLID, alpha: float = 1) whitecanvas.layers.primitive.bars.Bars[whitecanvas.layers._mixin.ConstFace, whitecanvas.layers.primitive.bars._Edge][source]

Update the face properties.

with_face_multi(color: Optional[Union[str, Iterable[int | float], cmap._color.Color, Sequence[Union[str, Iterable[int | float], cmap._color.Color]]]] = None, pattern: Union[str, whitecanvas.types._enums.FacePattern, Sequence[str | whitecanvas.types._enums.FacePattern]] = FacePattern.SOLID, alpha: float = 1) whitecanvas.layers.primitive.bars.Bars[whitecanvas.layers._mixin.MultiFace, whitecanvas.layers.primitive.bars._Edge][source]
with_text(strings: list[str], *, color: ColorType = 'black', size: float = 12, rotation: float = 0.0, anchor: str | Alignment = Alignment.BOTTOM_LEFT, fontfamily: str | None = None) _lg.LabeledBars[source]
with_xerr(err: ArrayLike1D, err_high: ArrayLike1D | None = None, *, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool | _Void = True, capsize: float = 0) _lg.LabeledBars[source]
with_yerr(err: ArrayLike1D, err_high: ArrayLike1D | None = None, *, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool = True, capsize: float = 0) _lg.LabeledBars[source]
class whitecanvas.layers.primitive.Errorbars(t: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], edge_low: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], edge_high: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, *, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'black', alpha: float = 1, width: float = 1, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, antialias: bool = True, capsize: float = 0.0, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers.primitive.line.MultiLine

Errorbars layer (parallel lines with caps).

property antialias: bool

Whether to use antialiasing.

property capsize: float

Size of the cap of the line edges.

property data: whitecanvas.types._tuples.XYYData

Current data of the layer.

classmethod empty(orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, backend: whitecanvas.backend._instance.Backend | str | None = None) whitecanvas.layers.primitive.errorbars.Errorbars[source]

Return an Errorbars instance with no component.

property ndata: int

Number of data points.

property orient: whitecanvas.types._enums.Orientation

Orientation of the error bars.

set_data(t: Optional[Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]] = None, edge_low: Optional[Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]] = None, edge_high: Optional[Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]] = None)[source]
update(color: typing.Union[str, typing.Iterable[int | float], cmap._color.Color, whitecanvas.types._alias._Void] = <whitecanvas.types._alias._Void object>, width: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, style: str | whitecanvas.types._enums.LineStyle | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, alpha: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, antialias: bool | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, capsize: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>)[source]
class whitecanvas.layers.primitive.Image(image: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], *, name: str | None = None, cmap: Union[str, cmap._colormap.Colormap, Any] = 'gray', clim: tuple[float | None, float | None] | None = None, shift: tuple[float, float] = (0, 0), scale: tuple[float, float] = (1.0, 1.0), backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers._base.PrimitiveLayer[whitecanvas.protocols.layer_protocols.ImageProtocol]

Grayscale or RGBA image layer.

Parameters
  • image (array_like) – 2D or 3D array of image data.

  • cmap (colormap type, default is "gray") – Colormap to use.

  • clim (tuple of float or None, optional) – Contrast limits. If None, the limits are set to the min and max of the data. You can also pass None separately to either limit to only autoscale one of them.

property clim: tuple[float, float]

Current contrast limits.

property cmap: cmap._colormap.Colormap

Current colormap.

property data: numpy.ndarray[Any, numpy.dtype[numpy.number]]

Current data of the layer.

fit_to(bbox: tuple[float, float, float, float]) whitecanvas.layers.primitive.image.Image[source]

Fit the image to the given bounding box.

property is_rgba: bool

Whether the image is RGBA.

property scale: tuple[float, float]

Current scale.

property shift: tuple[float, float]

Current shift from the origin.

update(*, cmap: ColormapType | _void = <whitecanvas.types._alias._Void object>, clim: tuple[float | None, float | None] | None | _Void = <whitecanvas.types._alias._Void object>, shift: tuple[float, float] | _void = <whitecanvas.types._alias._Void object>, scale: tuple[float, float] | _void = <whitecanvas.types._alias._Void object>) Image[source]
class whitecanvas.layers.primitive.InfCurve(model: Callable[[Concatenate[numpy.ndarray, _P]], numpy.ndarray], *, bounds: tuple[float, float] = (- inf, inf), name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1, width: float = 1, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, antialias: bool = True, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers.primitive.line.MonoLine, Generic[whitecanvas.layers.primitive.inf_curve._P]

property data: NoReturn
property model: Callable[[numpy.ndarray], numpy.ndarray]

The model function of the layer.

set_data(xdata=None, ydata=None) NoReturn[source]
with_params(*args: typing.~_P, **kwargs: typing.~_P) None[source]

Set the parameters of the model function.

class whitecanvas.layers.primitive.InfLine(pos: tuple[float, float] = (0, 0), angle: float = 0.0, *, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1, width: float = 1, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, antialias: bool = True, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers.primitive.line.MonoLine

property data: NoReturn
property pos: tuple[float, float]

One of the points on the line.

set_data(xdata=None, ydata=None) NoReturn[source]
class whitecanvas.layers.primitive.Line(xdata: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], ydata: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], *, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', width: float = 1, alpha: float = 1.0, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, antialias: bool = False, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers.primitive.line.MonoLine

property data: whitecanvas.types._tuples.XYData

Current data of the layer.

classmethod from_cdf(data: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], *, sorted: bool = False, orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1.0, width: float = 1.0, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Construct a line from a cumulative histogram.

classmethod from_histogram(data: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], *, bins: Union[int, Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]] = 10, density: bool = False, range: tuple[float, float] | None = None, orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1.0, width: float = 1.0, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Construct a line from a histogram.

set_data(xdata: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None, ydata: Optional[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]] = None)[source]
with_markers(symbol: Symbol | str = Symbol.CIRCLE, size: float = 10, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, alpha: float = 1.0, pattern: str | FacePattern = FacePattern.SOLID) _lg.Plot[source]
with_text(strings: list[str], *, color: ColorType = 'black', size: float = 12, rotation: float = 0.0, anchor: str | Alignment = Alignment.BOTTOM_LEFT, fontfamily: str | None = None) _lg.LabeledLine[source]
with_xband(err: ArrayLike1D, err_high: ArrayLike1D | None = None, *, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, alpha: float = 0.5, pattern: str | FacePattern = FacePattern.SOLID) _lg.LineBand[source]
with_xerr(err: ArrayLike1D, err_high: ArrayLike1D | None = None, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool | _Void = <whitecanvas.types._alias._Void object>, capsize: float = 0) _lg.LabeledLine[source]
with_xfill(bottom: float = 0.0, *, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, alpha: float = 0.5, pattern: str | FacePattern = FacePattern.SOLID) _lg.LineBand[source]
with_yband(err: ArrayLike1D, err_high: ArrayLike1D | None = None, *, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, alpha: float = 0.5, pattern: str | FacePattern = FacePattern.SOLID) _lg.LineBand[source]
with_yerr(err: ArrayLike1D, err_high: ArrayLike1D | None = None, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool | _Void = <whitecanvas.types._alias._Void object>, capsize: float = 0) _lg.LabeledLine[source]
with_yfill(bottom: float = 0.0, *, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, alpha: float = 0.5, pattern: str | FacePattern = FacePattern.SOLID) _lg.LineBand[source]
class whitecanvas.layers.primitive.Markers(xdata: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], ydata: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], *, name: str | None = None, symbol: whitecanvas.types._enums.Symbol | str = Symbol.CIRCLE, size: float = 15.0, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1.0, pattern: str | whitecanvas.types._enums.FacePattern = FacePattern.SOLID, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers._mixin.MultiFaceEdgeMixin[whitecanvas.protocols.layer_protocols.MarkersProtocol, whitecanvas.layers.primitive.markers._Face, whitecanvas.layers.primitive.markers._Edge], Generic[whitecanvas.layers.primitive.markers._Face, whitecanvas.layers.primitive.markers._Edge, whitecanvas.layers.primitive.markers._Size]

property data: whitecanvas.types._tuples.XYData

Current data of the layer.

classmethod empty(backend: Backend | str | None = None) Markers[ConstFace, ConstEdge, float][source]

Return an empty markers layer.

events: MarkersLayerEvents
property ndata: int

Number of data points.

set_data(xdata: Optional[Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]] = None, ydata: Optional[Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]] = None)[source]
property size: whitecanvas.layers.primitive.markers._Size

Size of the symbol.

property symbol: whitecanvas.types._enums.Symbol

Symbol used to mark the data points.

update(*, symbol: whitecanvas.types._enums.Symbol | str | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, size: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, color: typing.Union[str, typing.Iterable[int | float], cmap._color.Color, whitecanvas.types._alias._Void] = <whitecanvas.types._alias._Void object>, alpha: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, pattern: str | whitecanvas.types._enums.FacePattern | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>) whitecanvas.layers.primitive.markers.Markers[whitecanvas.layers.primitive.markers._Face, whitecanvas.layers.primitive.markers._Edge, whitecanvas.layers.primitive.markers._Size][source]

Update the properties of the markers.

with_edge(color: ColorType | None = None, width: float = 1.0, style: LineStyle | str = LineStyle.SOLID, alpha: float = 1.0) Markers[_Face, ConstEdge, _Size][source]

Update the edge properties.

with_edge_multi(color: ColorType | Sequence[ColorType] | None = None, width: float | Sequence[float] = 1.0, style: str | LineStyle | list[str | LineStyle] = LineStyle.SOLID, alpha: float = 1.0) Markers[_Face, MultiEdge, _Size][source]

Update the edge properties.

with_face(color: ColorType | None = None, pattern: FacePattern | str = FacePattern.SOLID, alpha: float = 1.0) Markers[ConstFace, _Edge, _Size][source]

Return a markers layer with constant face properties.

In most cases, this function is not needed because the face properties can be set directly on construction. Examples below are equivalent:

>>> markers = canvas.add_markers(x, y).with_face(color="red")
>>> markers = canvas.add_markers(x, y, color="red")

This function will be useful when you want to change the markers from multi-face state to constant-face state:

>>> markers = canvas.add_markers(x, y).with_face_multi(color=colors)
>>> markers = markers.with_face(color="red")
Parameters
  • color (color-like, optional) – Color of the marker faces.

  • pattern (str or FacePattern, optional) – Pattern (hatch) of the faces.

  • alpha (float, optional) – Alpha channel of the faces.

Returns

The updated markers layer.

Return type

Markers

with_face_multi(color: ColorType | Sequence[ColorType] | None = None, pattern: str | FacePattern | Sequence[str | FacePattern] = FacePattern.SOLID, alpha: float = 1) Markers[MultiFace, _Edge, _Size][source]

Return a markers layer with multi-face properties.

This function is used to create a markers layer with multiple face properties, such as colorful markers.

>>> markers = canvas.add_markers(x, y).with_face_multi(color=colors)
Parameters
  • color (color-like or sequence of color-like, optional) – Color(s) of the marker faces.

  • pattern (str or FacePattern or sequence of it, optional) – Pattern(s) of the faces.

  • alpha (float or sequence of float, optional) – Alpha channel(s) of the faces.

Returns

The updated markers layer.

Return type

Markers

with_hover_template(template: str, **kwargs) whitecanvas.layers.primitive.markers.Markers[whitecanvas.layers.primitive.markers._Face, whitecanvas.layers.primitive.markers._Edge, whitecanvas.layers.primitive.markers._Size][source]

Add hover template to the markers.

with_hover_text(text: Iterable[Any]) whitecanvas.layers.primitive.markers.Markers[whitecanvas.layers.primitive.markers._Face, whitecanvas.layers.primitive.markers._Edge, whitecanvas.layers.primitive.markers._Size][source]

Add hover text to the markers.

with_network(connections: NDArray[np.intp], color: ColorType | _Void = <whitecanvas.types._alias._Void object>, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool = True) _lg.Graph[source]

Add network edges to the markers to create a graph.

Parameters
  • connections ((N, 2) array of int) – Integer array that defines the connections between nodes.

  • color (color-like, optional) – Color of the lines.

  • width (float, optional) – Width of the line.

  • style (str, optional) – Line style of the line.

  • antialias (bool, optional) – Antialiasing of the line.

Returns

A Graph layer that contains the markers and the edges as children.

Return type

Graph

with_size_multi(size: Union[float, Sequence[float]]) whitecanvas.layers.primitive.markers.Markers[whitecanvas.layers.primitive.markers._Face, whitecanvas.layers.primitive.markers._Edge, numpy.ndarray[Any, numpy.dtype[numpy.float32]]][source]
with_stem(orient: str | Orientation = Orientation.VERTICAL, *, bottom: NDArray[np.floating] | float | None = None, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, alpha: float = 1.0, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool = True) _lg.StemPlot[source]

Grow stems from the markers.

Parameters
  • orient (str or Orientation, default is vertical) – Orientation to grow stems.

  • bottom (float or array-like, optional) – Bottom of the stems. If not specified, the bottom is set to 0.

  • color (color-like, optional) – Color of the lines.

  • alpha (float, optional) – Alpha channel of the lines.

  • width (float, optional) – Width of the lines.

  • style (str or LineStyle) – Line style used to draw the stems.

  • antialias (bool, optional) – Line antialiasing.

Returns

StemPlot layer containing the markers and the stems as children.

Return type

StemPlot

with_text(strings: list[str], *, color: ColorType = 'black', size: float = 12, rotation: float = 0.0, anchor: str | Alignment = Alignment.BOTTOM_LEFT, fontfamily: str | None = None) _lg.LabeledMarkers[source]
with_xerr(err: ArrayLike, err_high: ArrayLike | None = None, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool | _Void = True, capsize: float = 0) _lg.LabeledMarkers[source]

Add horizontal error bars to the markers.

Parameters
  • err (ArrayLike) – Error values. If err_high is not specified, the error bars are symmetric.

  • err_high (array-like, optional) – Upper error values.

  • color (color-like, optional) – Line color of the error bars.

  • width (float) – Width of the error bars.

  • style (str or LineStyle) – Line style of the error bars.

  • antialias (bool) – Antialiasing of the error bars.

  • capsize (float, optional) – Size of the caps at the end of the error bars.

Returns

Layer group containing the markers and the error bars as children.

Return type

LabeledMarkers

with_yerr(err: ArrayLike, err_high: ArrayLike | None = None, color: ColorType | _Void = <whitecanvas.types._alias._Void object>, width: float | _Void = <whitecanvas.types._alias._Void object>, style: str | _Void = <whitecanvas.types._alias._Void object>, antialias: bool = True, capsize: float = 0) _lg.LabeledMarkers[source]

Add vertical error bars to the markers.

Parameters
  • err (ArrayLike) – Error values. If err_high is not specified, the error bars are symmetric.

  • err_high (array-like, optional) – Upper error values.

  • color (color-like, optional) – Line color of the error bars.

  • width (float) – Width of the error bars.

  • style (str or LineStyle) – Line style of the error bars.

  • antialias (bool) – Antialiasing of the error bars.

  • capsize (float, optional) – Size of the caps at the end of the error bars.

Returns

Layer group containing the markers and the error bars as children.

Return type

LabeledMarkers

class whitecanvas.layers.primitive.MultiLine(data: list[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]], *, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', width: float = 1.0, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, antialias: bool = True, alpha: float = 1.0, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers._base.PrimitiveLayer[whitecanvas.protocols.layer_protocols.MultiLineProtocol]

property alpha: float

Alpha value of the line.

property antialias: bool

Whether to use antialiasing.

property color: numpy.ndarray[Any, numpy.dtype[numpy.floating]]

Color of the line.

property data: list[whitecanvas.types._tuples.XYData]

Current data of the layer.

property nlines: int

Number of lines.

set_data(data: list[Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]]])[source]
property style: whitecanvas.types._enums.LineStyle

Style of the line.

update(*, color: typing.Union[str, typing.Iterable[int | float], cmap._color.Color, whitecanvas.types._alias._Void] = <whitecanvas.types._alias._Void object>, alpha: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, width: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, style: str | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, antialias: bool | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>)[source]
property width: float

Width of the line.

class whitecanvas.layers.primitive.Rug(events: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], *, low: float = 0.0, high: float = 1.0, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'black', alpha: float = 1.0, orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, backend: str | whitecanvas.backend._instance.Backend | None = None)[source]

Bases: whitecanvas.layers.primitive.line.MultiLine

Rug plot (event plot) layer.

│ ││ │ │

──┴─┴┴──┴───┴──>

property data: numpy.ndarray[Any, numpy.dtype[numpy.number]]

Current data of the layer.

property high: float
property low: float
property orient: whitecanvas.types._enums.Orientation
set_data(events: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]])[source]
class whitecanvas.layers.primitive.Spans(spans: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], *, name: str | None = None, orient: str | whitecanvas.types._enums.Orientation = Orientation.VERTICAL, color: Union[str, Iterable[int | float], cmap._color.Color] = 'blue', alpha: float = 1.0, pattern: str | whitecanvas.types._enums.FacePattern = FacePattern.SOLID, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers._mixin.MultiFaceEdgeMixin[whitecanvas.protocols.layer_protocols.BarProtocol, whitecanvas.layers.primitive.spans._Face, whitecanvas.layers.primitive.spans._Edge]

Layer that represents vertical/hosizontal spans.

──────────────────────────────>

|///| |///////////| |///| |///////////|

property data: numpy.ndarray[Any, numpy.dtype[numpy.float64]]
property ndata: int

The number of data points

property orient: whitecanvas.types._enums.Orientation
set_data(spans: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]])[source]
with_edge(color: Optional[Union[str, Iterable[int | float], cmap._color.Color]] = None, width: float = 1, style: whitecanvas.types._enums.LineStyle | str = LineStyle.SOLID, alpha: float = 1) whitecanvas.layers.primitive.spans.Spans[whitecanvas.layers.primitive.spans._Face, whitecanvas.layers._mixin.ConstEdge][source]

Update the edge properties.

with_edge_multi(color: Optional[Union[str, Iterable[int | float], cmap._color.Color, Sequence[Union[str, Iterable[int | float], cmap._color.Color]]]] = None, width: Union[float, Sequence[float]] = 1, style: str | whitecanvas.types._enums.LineStyle | list[str | whitecanvas.types._enums.LineStyle] = LineStyle.SOLID, alpha: float = 1) whitecanvas.layers.primitive.spans.Spans[whitecanvas.layers.primitive.spans._Face, whitecanvas.layers._mixin.MultiEdge][source]

Update the edge properties.

with_face(color: Optional[Union[str, Iterable[int | float], cmap._color.Color]] = None, pattern: whitecanvas.types._enums.FacePattern | str = FacePattern.SOLID, alpha: float = 1) whitecanvas.layers.primitive.spans.Spans[whitecanvas.layers._mixin.ConstFace, whitecanvas.layers.primitive.spans._Edge][source]

Update the face properties.

with_face_multi(color: Optional[Union[str, Iterable[int | float], cmap._color.Color, Sequence[Union[str, Iterable[int | float], cmap._color.Color]]]] = None, pattern: Union[str, whitecanvas.types._enums.FacePattern, Sequence[str | whitecanvas.types._enums.FacePattern]] = FacePattern.SOLID, alpha: float = 1) whitecanvas.layers.primitive.spans.Spans[whitecanvas.layers._mixin.MultiFace, whitecanvas.layers.primitive.spans._Edge][source]
class whitecanvas.layers.primitive.Texts(x: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], y: Union[Sequence[Union[int, float, numpy.number]], numpy.ndarray[Any, numpy.dtype[numpy.number]]], text: Sequence[str], *, name: str | None = None, color: Union[str, Iterable[int | float], cmap._color.Color] = 'black', size: float | None = None, rotation: float = 0.0, anchor: whitecanvas.types._enums.Alignment = Alignment.BOTTOM_LEFT, fontfamily: str | None = None, backend: whitecanvas.backend._instance.Backend | str | None = None)[source]

Bases: whitecanvas.layers.primitive.text.TextBase

property anchor: whitecanvas.types._enums.Alignment

Anchor of the text.

property color

Color of the text.

property fontfamily: str

Font family of the text.

property rotation: float

Rotation of the text.

property size

Size of the text.

update(color: typing.Union[str, typing.Iterable[int | float], cmap._color.Color, whitecanvas.types._alias._Void] = <whitecanvas.types._alias._Void object>, size: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, rotation: float | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, anchor: whitecanvas.types._enums.Alignment | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>, fontfamily: str | whitecanvas.types._alias._Void = <whitecanvas.types._alias._Void object>) whitecanvas.layers.primitive.text.Texts[source]