-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathimage_widget_grid.py
More file actions
41 lines (32 loc) · 1.14 KB
/
image_widget_grid.py
File metadata and controls
41 lines (32 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""
Image widget grid
=================
Example showing how to view multiple images in an ImageWidget
"""
import fastplotlib as fpl
import imageio.v3 as iio
# test_example = true
# sphinx_gallery_pygfx_docs = 'screenshot'
img1 = iio.imread("imageio:camera.png")
img2 = iio.imread("imageio:astronaut.png")
img3 = iio.imread("imageio:chelsea.png")
img4 = iio.imread("imageio:wikkie.png")
iw = fpl.ImageWidget(
data=[img1, img2, img3, img4],
rgb=[False, True, True, True], # mix of grayscale and RGB images
names=["cameraman", "astronaut", "chelsea", "Almar's cat"],
# ImageWidget will sync controllers by default
# by setting `controller_ids=None` we can have independent controllers for each subplot
# this is useful when the images have different dimensions
figure_kwargs={"size": (700, 560), "controller_ids": None},
)
iw.show()
figure = iw.figure
for subplot in figure:
# sometimes the toolbar adds clutter
subplot.toolbar = False
# 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()