Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
97442f5
new cursor tool, basics work
kushalkolar Nov 19, 2025
034f719
lint and update api docs
clewis7 Nov 19, 2025
9a18381
add custom tooltip to figure
kushalkolar Nov 20, 2025
b08e744
Merge branch 'cursor-simpler' of https://github.com/fastplotlib/fastp…
kushalkolar Nov 20, 2025
cf0c6dd
example WIP
kushalkolar Nov 20, 2025
86807c2
manual picking, world obj -> graphic mapping
kushalkolar Nov 20, 2025
506fa2c
fix
kushalkolar Nov 20, 2025
f69ccc9
fix gc
kushalkolar Nov 20, 2025
c0c1203
stuff
kushalkolar Nov 25, 2025
cbc5127
Merge branch 'main' into cursor-simpler
kushalkolar Dec 6, 2025
5630f23
Merge branch 'cursor-simpler' of https://github.com/fastplotlib/fastp…
kushalkolar Dec 6, 2025
c5f8eac
cursor and tooltips refactor, basically works
kushalkolar Dec 6, 2025
9323e3a
much simpler tooltip and cursor
kushalkolar Dec 7, 2025
a59f686
move TextBox and Tooltip, update API docs
kushalkolar Dec 7, 2025
c60f1fe
cursor manages tooltips
kushalkolar Dec 7, 2025
32493b1
update examples
kushalkolar Dec 7, 2025
ed297f5
black
kushalkolar Dec 7, 2025
40f3357
cleanup
kushalkolar Dec 7, 2025
a3252eb
docstrings
kushalkolar Dec 7, 2025
c6133cd
update example
kushalkolar Dec 7, 2025
75d13fe
update example
kushalkolar Dec 7, 2025
6d535e7
add image space transforms examples
kushalkolar Dec 17, 2025
00b51a9
finish space transforms examples
kushalkolar Dec 17, 2025
1cafa74
typing
kushalkolar Dec 17, 2025
f585007
black
kushalkolar Dec 17, 2025
a64ce67
docstrings
kushalkolar Dec 17, 2025
a0f74c2
update examples
kushalkolar Dec 17, 2025
6a648e7
textbox constructor takes args, docstrings
kushalkolar Dec 17, 2025
dd65092
True -> true
kushalkolar Dec 17, 2025
cd0f216
update names
kushalkolar Dec 17, 2025
70c8088
update cursor examples
kushalkolar Dec 17, 2025
d4c3eb7
new ground truth screenshots for transforms
kushalkolar Dec 17, 2025
edca694
black
kushalkolar Dec 17, 2025
3570fba
update
kushalkolar Dec 17, 2025
a7bf44c
revert persist kwarg in PlotArea animations stuff
kushalkolar Dec 17, 2025
fba5247
fix
kushalkolar Dec 22, 2025
201b75c
message for image volumes
kushalkolar Dec 22, 2025
32c7d5f
Update fastplotlib/graphics/_base.py
clewis7 Jan 14, 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
much simpler tooltip and cursor
  • Loading branch information
kushalkolar committed Dec 7, 2025
commit 9323e3a82720dd65930451638b70fa4a6bcd7fa3
3 changes: 3 additions & 0 deletions examples/mesh/surface_ripple.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def create_ripple(shape=(100, 100), phase=0.0, freq=np.pi / 4, ampl=1.0):
z, mode="basic", cmap="viridis", clim=(-max_z, max_z)
)

# enable continuous updates for the tooltip
figure[0, 0].tooltip.continuous_update = True

figure[0, 0].camera.show_object(surface.world_object, (-1, 3, -1), up=(0, 0, 1))
figure.show()

Expand Down
61 changes: 0 additions & 61 deletions examples/misc/cursor_custom_tooltip.py

This file was deleted.

49 changes: 49 additions & 0 deletions examples/misc/cursor_manual.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""
Cursor transform
================

Create a cursor and add them to subplots with a transform function. An example usecase is image registration.
"""

# test_example = False
# sphinx_gallery_pygfx_docs = 'screenshot'

import numpy as np
import fastplotlib as fpl
import imageio.v3 as iio


# get an image
img1 = iio.imread("imageio:camera.png")

# create another image, but it is offset
img2 = np.zeros(img1.shape)
img2[50:, 20:] = img1[:-50, :-20]

figure = fpl.Figure((1, 2))

# add images
figure[0, 0].add_image(img1)
figure[0, 1].add_image(img2)

# create cursor
cursor = fpl.Cursor("crosshair")

# add first subplot to cursor
cursor.add_subplot(figure[0, 0])

# a transform function for subplot 2 to indicate that the data is shifted
def transform_func(pos):
return (pos[0] + 20, pos[1] + 50)

# add second subplot with a transform
cursor.add_subplot(figure[0, 1], transform=transform_func)

figure.show()


# NOTE: fpl.loop.run() should not be used for interactive sessions
# See the "JupyterLab and IPython" section in the user guide
if __name__ == "__main__":
print(__doc__)
fpl.loop.run()
14 changes: 10 additions & 4 deletions examples/misc/tooltips_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,26 @@
)


def tooltip_info(ev) -> str:
def tooltip_info(pick_info: dict) -> str:
# get index of the scatter point that is being hovered
index = ev.pick_info["vertex_index"]
index = pick_info["vertex_index"]

# get the species name
>
cluster = agg.labels_[index]
info = f"species: {dataset['target_names'][target]}\ncluster: {cluster}"

# the default formatting of the pick info
default_info = scatter.format_pick_info(pick_info)

info = (f"species: {dataset['target_names'][target]}\n"
f"cluster: {cluster}\n\n"
f"{default_info}")

# return this string to display it in the tooltip
return info


figure.tooltip_manager.register(scatter, custom_info=tooltip_info)
scatter.tooltip_format = tooltip_info

figure.show()

Expand Down
8 changes: 4 additions & 4 deletions fastplotlib/graphics/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from ._tooltip import Tooltip
from ._base import Graphic, GraphicTooltip
from ._base import Graphic
from .line import LineGraphic
from .scatter import ScatterGraphic
from .image import ImageGraphic
Expand All @@ -8,11 +7,10 @@
from .mesh import MeshGraphic, SurfaceGraphic, PolygonGraphic
from .text import TextGraphic
from .line_collection import LineCollection, LineStack
from ._tooltip import TextBox, Tooltip


__all__ = [
"Tooltip",
"GraphicTooltip",
"Graphic",
"LineGraphic",
"ScatterGraphic",
Expand All @@ -25,4 +23,6 @@
"TextGraphic",
"LineCollection",
"LineStack",
"TextBox",
"Tooltip",
]
Loading
Loading