Note
Go to the end to download the full example code.
ImageWidget test viewport rects#
Test Figure to test that viewport rects are positioned correctly in an image widget
# test_example = true
import fastplotlib as fpl
import numpy as np
np.random.seed(0)
a = np.random.rand(6, 15, 10, 10)
iw = fpl.ImageWidget(
data=[img for img in a],
names=list(map(str, range(6))),
figure_kwargs={"size": (700, 560)},
)
for subplot in iw.figure:
subplot.docks["left"].size = 10
subplot.docks["bottom"].size = 40
iw.show()
figure = iw.figure
# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively
# please see our docs for using fastplotlib interactively in ipython and jupyter
if __name__ == "__main__":
print(__doc__)
fpl.loop.run()