.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_gallery/controllers/specify_integers.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_controllers_specify_integers.py: Specify IDs with integers ========================= Specify controllers to sync subplots using integer IDs .. GENERATED FROM PYTHON SOURCE LINES 7-50 .. image-sg:: /_gallery/controllers/images/sphx_glr_specify_integers_001.webp :alt: specify integers :srcset: /_gallery/controllers/images/sphx_glr_specify_integers_001.webp :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /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 fastplotlib as fpl xs = np.linspace(0, 2 * np.pi, 100) sine = np.sin(xs) cosine = np.cos(xs) # controller IDs # one controller is created for each unique ID # if the IDs are the same, those subplots will be synced ids = [ [0, 1], [2, 0], ] names = [f"contr. id: {i}" for i in np.asarray(ids).ravel()] figure = fpl.Figure( shape=(2, 2), controller_ids=ids, names=names, size=(700, 560), ) figure[0, 0].add_line(np.column_stack([xs, sine])) figure[0, 1].add_line(np.random.rand(100)) figure[1, 0].add_line(np.random.rand(100)) figure[1, 1].add_line(np.column_stack([xs, cosine])) figure.show(maintain_aspect=False) # 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.753 seconds) .. _sphx_glr_download__gallery_controllers_specify_integers.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: specify_integers.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: specify_integers.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: specify_integers.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_