Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
c221cff
refactor cmap and cmap_transform for positional graphics
kushalkolar Aug 8, 2026
125a128
color mode stuff
kushalkolar Aug 8, 2026
5e0bd95
WIP
kushalkolar Aug 13, 2026
b269f07
more WIP
kushalkolar Aug 14, 2026
3914db6
better add_graphic autogen
kushalkolar Aug 19, 2026
419069a
more progress
kushalkolar Aug 19, 2026
8fe4054
mostly done refactoring positions graphics cmap stuff
kushalkolar Aug 20, 2026
ad2e1d0
forgot to update mixin
kushalkolar Aug 20, 2026
782017f
cmap_transform tweaks
kushalkolar Aug 24, 2026
b102462
wip, JaggedArray
kushalkolar Aug 30, 2026
1f3def7
mostly works, writing tests
kushalkolar Sep 1, 2026
42aceb9
remove a print
kushalkolar Sep 1, 2026
0284cfa
image collection examples
kushalkolar Sep 2, 2026
c9fe59d
fix
kushalkolar Sep 2, 2026
21c9f68
feature inheritance in PositionsGraphic and cmap_range
kushalkolar Sep 2, 2026
b1f8d2e
cmap handling
kushalkolar Sep 2, 2026
ebfa98a
cmap tweaks
kushalkolar Sep 3, 2026
bff755b
remove parse_cmap_values, rely on cmap lib
kushalkolar Sep 3, 2026
f9c23f2
fix example, remove unused line of code
kushalkolar Sep 3, 2026
665952c
Image just uses cmap lib now too
kushalkolar Sep 3, 2026
f43d25f
delete_ndgraphic()
kushalkolar Sep 3, 2026
e3035c6
ndtimeseries cmap example
kushalkolar Sep 3, 2026
a997728
steps for stacks
kushalkolar Sep 3, 2026
565a689
ndtimeseries sets stack steps
kushalkolar Sep 3, 2026
467029f
docstrings
kushalkolar Sep 5, 2026
bc844c0
docstrings
kushalkolar Sep 5, 2026
72371e1
comments
kushalkolar Sep 5, 2026
7fb798b
renames
kushalkolar Sep 5, 2026
d51d19c
docstring
kushalkolar Sep 5, 2026
29c95f2
fixes
kushalkolar Sep 8, 2026
687e10a
update tests/test_colors_buffer_manager.py
kushalkolar Sep 9, 2026
a23cfb0
update test_markers_buffer_manager.py
kushalkolar Sep 9, 2026
a9d9444
update plot_helpers test
kushalkolar Sep 9, 2026
c52e829
update test_point_rotations_buffer_manager.py
kushalkolar Sep 9, 2026
7246c96
update test_positions_graphics.py
kushalkolar Sep 9, 2026
3225331
update another test
kushalkolar Sep 9, 2026
ebbae33
more tests
kushalkolar Sep 9, 2026
a568853
update yet more tests
kushalkolar Sep 9, 2026
aec89c9
remove unused
kushalkolar Sep 9, 2026
a32d3af
infline tests
kushalkolar Sep 9, 2026
650fd29
collections tests
kushalkolar Sep 9, 2026
c024321
updating examples, wip
kushalkolar Sep 9, 2026
45ea886
more examples updates
kushalkolar Sep 9, 2026
4a8f444
more examples updates
kushalkolar Sep 9, 2026
92e34d9
more example updates
kushalkolar Sep 9, 2026
f0ddde1
more example updates
kushalkolar Sep 9, 2026
7b04a0d
example and docstring
kushalkolar Sep 9, 2026
55864b0
docstring
kushalkolar Sep 9, 2026
2554a3d
remove complex line collection slicing example, stick with real usecases
kushalkolar Sep 9, 2026
4148e3c
better line stack example
kushalkolar Sep 9, 2026
b6b80ba
update example
kushalkolar Sep 9, 2026
d6a8fb8
update example
kushalkolar Sep 9, 2026
712d94b
update link
kushalkolar Sep 9, 2026
2949c81
update more examples
kushalkolar Sep 9, 2026
a5dd607
examples and fixes
kushalkolar Sep 9, 2026
2d59e6a
fix
kushalkolar Sep 9, 2026
b57d0a4
more fixes
kushalkolar Sep 9, 2026
df7c823
fix
kushalkolar Sep 9, 2026
cfdfdca
updates
kushalkolar Sep 9, 2026
cad9ee4
Fix
kushalkolar Sep 9, 2026
dee42ec
update docs
kushalkolar Sep 9, 2026
05acb46
docs
kushalkolar Sep 9, 2026
87f74b0
add image collection to docs conf.py
kushalkolar Sep 9, 2026
911570f
update docs
kushalkolar Sep 9, 2026
d5f1da9
Merge branch 'ndwidget' into flat-gfeatures2
kushalkolar Sep 9, 2026
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
Prev Previous commit
Next Next commit
more fixes
  • Loading branch information
kushalkolar committed Sep 9, 2026
commit b57d0a4bc6aa732f3eb25de2611c2bb9cb07f845
18 changes: 6 additions & 12 deletions examples/selection_tools/linear_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@
line_selector_text,
offset=(0., 1.75, 0.),
anchor="middle-left",
font_size=32,
face_color=line.colors[0],
outline_color="w",
outline_thickness=0.1,
font_size=24,
)


Expand All @@ -65,18 +62,15 @@ def line_selector_changed(ev):
f"y value: {line.data[index, 1]:.2f}\n"
f"index: {index}")

# set text color based on line color at selection index
line_selection_label.face_color = line.colors[index]


# line stack, sine and cosine wave
line_stack = figure[0, 1].add_line_stack([sine, cosine], colors=["magenta", "cyan"], separation=1)
line_stack = figure[0, 1].add_line_stack([sine, cosine], colors=["magenta", "cyan"], separation=(0, 1, 0))
line_stack_selector = line_stack.add_linear_selector()

line_stack_selector_text = (f"x value: {line_stack_selector.selection / np.pi:.2f}蟺\n"
f"index: {line_selector.get_selected_index()}\n"
f"sine y value: {line_stack[0].data[0, 1]:.2f}\n"
f"cosine y value: {line_stack[1].data[0, 1]:.2f}\n")
f"sine y value: {line_stack.data[0, 0, 1]:.2f}\n"
f"cosine y value: {line_stack.data[1, 0, 1]:.2f}\n")

# a label that will change to display line_stack data based on the linear selector
line_stack_selector_label = figure[0, 1].add_text(
Expand All @@ -99,8 +93,8 @@ def line_stack_selector_changed(ev):
line_stack_selector_label.text = \
(f"x value: {selection / np.pi:.2f}蟺\n"
f"index: {index}\n"
f"sine y value: {line_stack[0].data[index, 1]:.2f}\n"
f"cosine y value: {line_stack[1].data[index, 1]:.2f}\n")
f"sine y value: {line_stack.data[0, index, 1]:.2f}\n"
f"cosine y value: {line_stack.data[1, index, 1]:.2f}\n")


# add an event handler, you can also use a decorator
Expand Down
9 changes: 6 additions & 3 deletions examples/selection_tools/polygon_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ def make_circle(center, radius: float, n_points: int = 75) -> np.ndarray:

pos_xy = np.vstack(circles)

colors = np.random.rand(len(circles), 3)

# add image
line_collection = figure[0, 0].add_line_collection(circles, cmap="jet", thickness=5)
line_collection = figure[0, 0].add_line_collection(circles, colors=colors, thickness=5)

# add polygon selector to image graphic
polygon_selector = line_collection.add_polygon_selector(
Expand All @@ -45,11 +47,12 @@ def make_circle(center, radius: float, n_points: int = 75) -> np.ndarray:
# add event handler to highlight selected indices
@polygon_selector.add_event_handler("selection")
def color_indices(ev):
line_collection.cmap = "jet"
line_collection.colors = colors
ixs = ev.get_selected_indices()
# iterate through each of the selected indices, if the array size > 0 that mean it's under the selection
selected_line_ixs = [i for i in range(len(ixs)) if ixs[i].size > 0]
line_collection[selected_line_ixs].colors = "w"
# boolean indexing of a collection property
line_collection.colors[selected_line_ixs] = "w"


# # manually move selector to make a nice gallery image :D
Expand Down
5 changes: 5 additions & 0 deletions fastplotlib/graphics/_jagged_array.py
Comment thread
kushalkolar marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ def __setitem__(self, key, value):
# multiple graphics: they must all be the same mode, then split `value` along the
# graphic axis and hand each graphic its piece
selected = self._graphics[graphic_key]

if len(selected < 1):
# nothing to set
return

self._verify_homogenous_buffer_type(selected)
for graphic, graphic_value in zip(
selected, self._broadcast_over_graphics(value, len(selected))
Expand Down
4 changes: 2 additions & 2 deletions fastplotlib/graphics/features/_positions.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,14 @@ def __init__(self, data: Any, property_name: str = "data"):
def _fix_data(self, data):
if data.ndim == 1:
# if user provides a 1D array, assume these are y-values
data = np.column_stack([np.arange(data.size, dtype=data.dtype), data])
data = np.column_stack([np.arange(data.size, dtype=np.float32), data])

if data.shape[1] != 3:
if data.shape[1] != 2:
raise ValueError(f"Must pass 1D, 2D or 3D data")

# zeros for z
zs = np.zeros(data.shape[0], dtype=data.dtype)
zs = np.zeros(data.shape[0], dtype=np.float32)

# column stack [x, y, z] to make data of shape [n_points, 3]
data = np.column_stack([data[:, 0], data[:, 1], zs])
Expand Down