Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions fastplotlib/widgets/nd_widget/_nd_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def __init__(
spatial_func: Callable[[ArrayProtocol], ArrayProtocol] = None,
slider_dim_transforms=None,
name: str = None,
graphic_kwargs: dict = None,
):
"""
``NDGraphic`` subclass for n-dimensional vector rendering
Expand Down Expand Up @@ -257,6 +258,11 @@ def __init__(

self._graphic: VectorsGraphic | None = None

if graphic_kwargs is None:
self._graphic_kwargs = dict()
else:
self._graphic_kwargs = graphic_kwargs

# create a graphic
self._create_graphic()

Expand Down Expand Up @@ -293,8 +299,10 @@ def _create_graphic(self):
self._subplot.delete_graphic(old_graphic)

# create the new graphic
self._graphic = self._subplot.add_vectors(
positions=data_slice[:, 0], directions=data_slice[:, 1]
self._graphic = VectorsGraphic(
positions=data_slice[:, 0],
directions=data_slice[:, 1],
**self._graphic_kwargs
)

self._subplot.add_graphic(self._graphic)
Expand Down
2 changes: 2 additions & 0 deletions fastplotlib/widgets/nd_widget/_ndw_subplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def add_nd_vectors(
spatial_func: Callable[[ArrayProtocol], ArrayProtocol] = None,
slider_dim_transforms=None,
name: str = None,
**kwargs
) -> NDVectors:
nd = NDVectors(
self.ndw.indices,
Expand All @@ -106,6 +107,7 @@ def add_nd_vectors(
spatial_func=spatial_func,
slider_dim_transforms=slider_dim_transforms,
name=name,
**kwargs
)

self._nd_graphics.append(nd)
Expand Down