.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_gallery/misc/tooltips.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr__gallery_misc_tooltips.py: Tooltips ======== Show tooltips on all graphics .. GENERATED FROM PYTHON SOURCE LINES 7-54 .. image-sg:: /_gallery/misc/images/sphx_glr_tooltips_001.webp :alt: tooltips :srcset: /_gallery/misc/images/sphx_glr_tooltips_001.webp :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/pygfx/objects/_ruler.py:270: RuntimeWarning: divide by zero encountered in divide screen_full = (ndc_full[:, :2] / ndc_full[:, 3:4]) * half_canvas_size /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/pygfx/objects/_ruler.py:270: RuntimeWarning: invalid value encountered in divide screen_full = (ndc_full[:, :2] / ndc_full[:, 3:4]) * half_canvas_size /opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/site-packages/pygfx/objects/_ruler.py:282: RuntimeWarning: invalid value encountered in divide screen_sel = (ndc_sel[:, :2] / ndc_sel[:, 3:4]) * half_canvas_size /home/runner/work/fastplotlib/fastplotlib/fastplotlib/graphics/features/_base.py:18: UserWarning: casting float64 array to float32 warn(f"casting {array.dtype} array to float32") | .. code-block:: Python # test_example = false import numpy as np import imageio.v3 as iio import fastplotlib as fpl # get some data scatter_data = np.random.rand(1_000, 3) xs = np.linspace(0, 2 * np.pi, 100) ys = np.sin(xs) gray = iio.imread("imageio:camera.png") rgb = iio.imread("imageio:astronaut.png") # create a figure figure = fpl.Figure( cameras=["3d", "2d", "2d", "2d"], controller_types=["orbit", "panzoom", "panzoom", "panzoom"], size=(700, 560), shape=(2, 2), show_tooltips=True, # tooltip will display data value info for all graphics ) # create graphics scatter = figure[0, 0].add_scatter(scatter_data, sizes=3, colors="r") line = figure[0, 1].add_line(np.column_stack([xs, ys])) image = figure[1, 0].add_image(gray) image_rgb = figure[1, 1].add_image(rgb) figure.show() # to hide tooltips for all graphics in an existing Figure # figure.show_tooltips = False # to show tooltips for all graphics in an existing Figure # figure.show_tooltips = True # 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() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.920 seconds) .. _sphx_glr_download__gallery_misc_tooltips.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: tooltips.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: tooltips.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: tooltips.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_