diff --git a/docs/source/api/graphics/Graphic.rst b/docs/source/api/graphics/Graphic.rst index 08ab0404b..cf68888f5 100644 --- a/docs/source/api/graphics/Graphic.rst +++ b/docs/source/api/graphics/Graphic.rst @@ -42,6 +42,4 @@ Methods Graphic.clear_event_handlers Graphic.remove_event_handler Graphic.rotate - Graphic.share_property - Graphic.unshare_property diff --git a/docs/source/api/graphics/ImageGraphic.rst b/docs/source/api/graphics/ImageGraphic.rst index dd5ff1ccc..27bda3d32 100644 --- a/docs/source/api/graphics/ImageGraphic.rst +++ b/docs/source/api/graphics/ImageGraphic.rst @@ -52,6 +52,4 @@ Methods ImageGraphic.remove_event_handler ImageGraphic.reset_vmin_vmax ImageGraphic.rotate - ImageGraphic.share_property - ImageGraphic.unshare_property diff --git a/docs/source/api/graphics/LineCollection.rst b/docs/source/api/graphics/LineCollection.rst index ad4b7f929..12c7b5c95 100644 --- a/docs/source/api/graphics/LineCollection.rst +++ b/docs/source/api/graphics/LineCollection.rst @@ -57,6 +57,4 @@ Methods LineCollection.remove_event_handler LineCollection.remove_graphic LineCollection.rotate - LineCollection.share_property - LineCollection.unshare_property diff --git a/docs/source/api/graphics/LineGraphic.rst b/docs/source/api/graphics/LineGraphic.rst index 4302ab56c..c6e18b41b 100644 --- a/docs/source/api/graphics/LineGraphic.rst +++ b/docs/source/api/graphics/LineGraphic.rst @@ -50,6 +50,4 @@ Methods LineGraphic.clear_event_handlers LineGraphic.remove_event_handler LineGraphic.rotate - LineGraphic.share_property - LineGraphic.unshare_property diff --git a/docs/source/api/graphics/LineStack.rst b/docs/source/api/graphics/LineStack.rst index db060a4c2..e1deb75ae 100644 --- a/docs/source/api/graphics/LineStack.rst +++ b/docs/source/api/graphics/LineStack.rst @@ -57,6 +57,4 @@ Methods LineStack.remove_event_handler LineStack.remove_graphic LineStack.rotate - LineStack.share_property - LineStack.unshare_property diff --git a/docs/source/api/graphics/ScatterGraphic.rst b/docs/source/api/graphics/ScatterGraphic.rst index 83e734c61..968f0e091 100644 --- a/docs/source/api/graphics/ScatterGraphic.rst +++ b/docs/source/api/graphics/ScatterGraphic.rst @@ -47,6 +47,4 @@ Methods ScatterGraphic.clear_event_handlers ScatterGraphic.remove_event_handler ScatterGraphic.rotate - ScatterGraphic.share_property - ScatterGraphic.unshare_property diff --git a/docs/source/api/graphics/TextGraphic.rst b/docs/source/api/graphics/TextGraphic.rst index 2a55d78ef..60cd97f40 100644 --- a/docs/source/api/graphics/TextGraphic.rst +++ b/docs/source/api/graphics/TextGraphic.rst @@ -47,6 +47,4 @@ Methods TextGraphic.clear_event_handlers TextGraphic.remove_event_handler TextGraphic.rotate - TextGraphic.share_property - TextGraphic.unshare_property diff --git a/docs/source/api/selectors/LinearRegionSelector.rst b/docs/source/api/selectors/LinearRegionSelector.rst index 6c8d2eefc..2c23bc82a 100644 --- a/docs/source/api/selectors/LinearRegionSelector.rst +++ b/docs/source/api/selectors/LinearRegionSelector.rst @@ -52,6 +52,4 @@ Methods LinearRegionSelector.get_selected_indices LinearRegionSelector.remove_event_handler LinearRegionSelector.rotate - LinearRegionSelector.share_property - LinearRegionSelector.unshare_property diff --git a/docs/source/api/selectors/LinearSelector.rst b/docs/source/api/selectors/LinearSelector.rst index b82e3c1df..c7a8e978a 100644 --- a/docs/source/api/selectors/LinearSelector.rst +++ b/docs/source/api/selectors/LinearSelector.rst @@ -52,6 +52,4 @@ Methods LinearSelector.get_selected_indices LinearSelector.remove_event_handler LinearSelector.rotate - LinearSelector.share_property - LinearSelector.unshare_property diff --git a/docs/source/api/selectors/RectangleSelector.rst b/docs/source/api/selectors/RectangleSelector.rst index 81c9afd66..24928c817 100644 --- a/docs/source/api/selectors/RectangleSelector.rst +++ b/docs/source/api/selectors/RectangleSelector.rst @@ -52,6 +52,4 @@ Methods RectangleSelector.get_selected_indices RectangleSelector.remove_event_handler RectangleSelector.rotate - RectangleSelector.share_property - RectangleSelector.unshare_property diff --git a/docs/source/api/tools/HistogramLUTTool.rst b/docs/source/api/tools/HistogramLUTTool.rst index d134eb1ce..7c3237490 100644 --- a/docs/source/api/tools/HistogramLUTTool.rst +++ b/docs/source/api/tools/HistogramLUTTool.rst @@ -48,6 +48,4 @@ Methods HistogramLUTTool.remove_event_handler HistogramLUTTool.rotate HistogramLUTTool.set_data - HistogramLUTTool.share_property - HistogramLUTTool.unshare_property diff --git a/docs/source/conf.py b/docs/source/conf.py index 8d17c97ae..e4ff72237 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -49,6 +49,7 @@ sphinx_gallery_conf = { "gallery_dirs": "_gallery", + "notebook_extensions": {}, # remove the download notebook button "backreferences_dir": "_gallery/backreferences", "doc_module": ("fastplotlib",), "image_scrapers": ("pygfx",), @@ -105,7 +106,14 @@ "switcher": { "json_url": "http://www.fastplotlib.org/_static/switcher.json", "version_match": release - } + }, + "icon_links": [ + { + "name": "Github", + "url": "https://github.com/fastplotlib/fastplotlib", + "icon": "fa-brands fa-github", + } + ] } html_static_path = ["_static"] diff --git a/docs/source/user_guide/guide.rst b/docs/source/user_guide/guide.rst index 073fa806c..4f3dc64cb 100644 --- a/docs/source/user_guide/guide.rst +++ b/docs/source/user_guide/guide.rst @@ -667,28 +667,61 @@ There are several spaces to consider when using ``fastplotlib``: For more information on the various spaces used by rendering engines please see this `article `_ -Using ``fastplotlib`` in an interactive shell ---------------------------------------------- +JupyterLab and IPython +---------------------- -There are multiple ways to use ``fastplotlib`` in interactive shells, such as ipython. +In ``jupyter lab`` you have the option to embed ``Figures`` in regular output cells, on the side with ``sidecar``, +or show figures in separate Qt windows. Note: Once you have selected a display mode, we do not recommend switching to +a different display mode. Restart the kernel to reliably choose a different display mode. By default, fastplotlib +figures will be embedded in the notebook cell's output. -1) Jupyter +The `quickstart example notebook `_ +is also a great place to start. -On ``jupyter lab`` the jupyter backend (i.e. ``jupyter_rfb``) is normally selected. This works via -client-server rendering. Images generated on the server are streamed to the client (Jupyter) via a jpeg byte stream. -Events (such as mouse or keyboard events) are then streamed in the opposite direction prompting new images to be generated -by the server if necessary. This remote-frame-buffer approach makes the rendering process very fast. ``fastplotlib`` viusalizations -can be displayed in cell output or on the side using ``sidecar``. +Notebooks and remote rendering +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -A Qt backend can also optionally be used as well. If ``%gui qt`` is selected before importing ``fastplotlib`` then this backend -will be used instead. +To display the ``Figure`` in the notebook output, the ``fig.show()`` call must be the last line in the code cell. Or +you can use ipython's display call: ``display(fig.show())``. -Lastly, users can also force using ``glfw`` by specifying this as an argument when instantiating a ``Figure`` (i.e. ``Figure(canvas="gflw"``). +To display the figure on the side: ``fig.show(sidecar=True)`` -.. note:: - Do not mix between gui backends. For example, if you start the notebook using Qt, do not attempt to force using another backend such - as ``jupyter_rfb`` later. +You can make use of all `ipywidget layout `_ +options to display multiple figures:: + + from ipywidgets import VBox, HBox + + # stack figures vertically or horizontally + VBox([fig1.show(), fig2.show()]) + +Again the ``VBox([...])`` call must be the last line in the code cell, or you can use ``display(VBox([...]))`` + +You can combine ipywidget layouting just like any other ipywidget:: + + # display a figure on top of two figures laid out horizontally + + VBox([ + fig1.show(), + HBox([fig2.show(), fig3.show()]) + ]) + +Embedded figures will also render if you're using the notebook from a remote computer since rendering is done on the +server side and the client only receives a jpeg stream of rendered frames. This allows you to visualize very large +datasets on remote servers since the rendering is done remotely and you do not transfer any of the raw data to the +client. + +You can create dashboards or webapps with ``fastplotlib`` by running the notebook with +`voila `_. This is great for sharing visualizations of very large datasets +that are too large to share over the internet, and creating fast interactive applications for the analysis of very +large datasets. + +Qt windows in jupyter and IPython +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -2) IPython +Qt windows can also be used for displaying fastplotlib figures in an interactive jupyterlab or IPython. You must run +``%gui qt`` **before** importing ``fastplotlib`` (or ``wgpu``). This would typically be done at the very top of your +notebook. -Users can select between using a Qt backend or gflw using the same methods as above. +Note that this only works if you are using jupyterlab or ipython locally, this cannot be used for remote rendering. +You can forward windows (ex: X11 forwarding) but this is much slower than the remote rendering described in the +previous section. diff --git a/examples/controllers/specify_integers.py b/examples/controllers/specify_integers.py index 14b09b015..e74b9dd28 100644 --- a/examples/controllers/specify_integers.py +++ b/examples/controllers/specify_integers.py @@ -43,8 +43,8 @@ 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 +# 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() diff --git a/examples/controllers/specify_names.py b/examples/controllers/specify_names.py index fb0539c4a..0023651a7 100644 --- a/examples/controllers/specify_names.py +++ b/examples/controllers/specify_names.py @@ -40,8 +40,8 @@ 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 +# 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() diff --git a/examples/controllers/sync_all.py b/examples/controllers/sync_all.py index 0683a8827..3a1ee0093 100644 --- a/examples/controllers/sync_all.py +++ b/examples/controllers/sync_all.py @@ -23,8 +23,8 @@ 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 +# 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() diff --git a/examples/events/cmap_event.py b/examples/events/cmap_event.py index 6cd68f333..62913cb29 100644 --- a/examples/events/cmap_event.py +++ b/examples/events/cmap_event.py @@ -68,8 +68,8 @@ def cmap_changed(ev: fpl.GraphicFeatureEvent): # change the cmap of graphic image, triggers all other graphics to set the cmap figure["camera"].graphics[0].cmap = "jet" -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/events/drag_points.py b/examples/events/drag_points.py index 9a91779d4..752430c7c 100644 --- a/examples/events/drag_points.py +++ b/examples/events/drag_points.py @@ -92,8 +92,8 @@ def end_drag(ev: pygfx.PointerEvent): figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/events/image_click.py b/examples/events/image_click.py index acb6cde37..729a67586 100644 --- a/examples/events/image_click.py +++ b/examples/events/image_click.py @@ -37,8 +37,8 @@ def click_event(ev: pygfx.PointerEvent): print(xy) -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/events/image_data_event.py b/examples/events/image_data_event.py index 32f78996c..f97b1115e 100644 --- a/examples/events/image_data_event.py +++ b/examples/events/image_data_event.py @@ -48,8 +48,8 @@ def data_changed(ev: fpl.GraphicFeatureEvent): image_raw.data = img2 -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/events/key_events.py b/examples/events/key_events.py index 6979d44d7..f8cf2f3df 100644 --- a/examples/events/key_events.py +++ b/examples/events/key_events.py @@ -77,8 +77,8 @@ def handle_event(ev: pygfx.KeyboardEvent): figure = iw.figure # ignore, this is just so the docs gallery scraper picks up the figure -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/events/line_data_thickness_event.py b/examples/events/line_data_thickness_event.py index 4baaba42c..83f9322cb 100644 --- a/examples/events/line_data_thickness_event.py +++ b/examples/events/line_data_thickness_event.py @@ -72,8 +72,8 @@ def change_data(ev: fpl.GraphicFeatureEvent): # that causes the sine graphic's thickness to also be set from this value cosine_graphic.thickness = 10 -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/events/lines_mouse_nearest.py b/examples/events/lines_mouse_nearest.py index 8c9601de6..8d38e9f53 100644 --- a/examples/events/lines_mouse_nearest.py +++ b/examples/events/lines_mouse_nearest.py @@ -55,8 +55,8 @@ def highlight_nearest(ev: pygfx.PointerEvent): figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/events/paint_image.py b/examples/events/paint_image.py index cfc2eda11..46ef43114 100644 --- a/examples/events/paint_image.py +++ b/examples/events/paint_image.py @@ -64,8 +64,8 @@ def on_pointer_up(ev: pygfx.PointerEvent): figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/events/scatter_click.py b/examples/events/scatter_click.py index e56dca743..3bf85558a 100644 --- a/examples/events/scatter_click.py +++ b/examples/events/scatter_click.py @@ -59,8 +59,8 @@ def highlight_point(ev: pygfx.PointerEvent): figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/events/scatter_hover.py b/examples/events/scatter_hover.py index 9d69dc24c..c297223d2 100644 --- a/examples/events/scatter_hover.py +++ b/examples/events/scatter_hover.py @@ -62,8 +62,8 @@ def highlight_point(ev: pygfx.PointerEvent): figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/events/scatter_hover_transforms.py b/examples/events/scatter_hover_transforms.py index 7f9fbb9ff..18e6f3de5 100644 --- a/examples/events/scatter_hover_transforms.py +++ b/examples/events/scatter_hover_transforms.py @@ -24,7 +24,7 @@ import pygfx # get the dataset -dataset = fetch_california_housing() +dataset = fetch_california_housing(n_retries=5, delay=20) X_full, y = dataset.data, dataset.target feature_names = dataset.feature_names @@ -119,8 +119,8 @@ def highlight_point(ev: pygfx.PointerEvent): 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 +# 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() diff --git a/examples/gridplot/gridplot.py b/examples/gridplot/gridplot.py index af4d82408..5edd6a845 100644 --- a/examples/gridplot/gridplot.py +++ b/examples/gridplot/gridplot.py @@ -26,8 +26,8 @@ figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/gridplot/gridplot_non_square.py b/examples/gridplot/gridplot_non_square.py index e8ce15b7b..da0bf14c3 100644 --- a/examples/gridplot/gridplot_non_square.py +++ b/examples/gridplot/gridplot_non_square.py @@ -24,8 +24,8 @@ figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/gridplot/gridplot_viewports_check.py b/examples/gridplot/gridplot_viewports_check.py index 496204b98..45f9d7004 100644 --- a/examples/gridplot/gridplot_viewports_check.py +++ b/examples/gridplot/gridplot_viewports_check.py @@ -30,8 +30,8 @@ figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/gridplot/multigraphic_gridplot.py b/examples/gridplot/multigraphic_gridplot.py index 8408f4f23..d89168ec9 100644 --- a/examples/gridplot/multigraphic_gridplot.py +++ b/examples/gridplot/multigraphic_gridplot.py @@ -110,8 +110,8 @@ def make_circle(center, radius: float, n_points: int = 75) -> np.ndarray: figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/guis/image_widget_imgui.py b/examples/guis/image_widget_imgui.py index 13d41af20..759d87a07 100644 --- a/examples/guis/image_widget_imgui.py +++ b/examples/guis/image_widget_imgui.py @@ -75,8 +75,8 @@ def process_image(self): 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 +# 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() diff --git a/examples/guis/imgui_basic.py b/examples/guis/imgui_basic.py index eac39121c..26b5603c0 100644 --- a/examples/guis/imgui_basic.py +++ b/examples/guis/imgui_basic.py @@ -116,8 +116,8 @@ def _set_data(self): figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/guis/sine_cosine_funcs.py b/examples/guis/sine_cosine_funcs.py index c91a3b2e8..09a5ec990 100644 --- a/examples/guis/sine_cosine_funcs.py +++ b/examples/guis/sine_cosine_funcs.py @@ -179,8 +179,8 @@ def update(self): figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/heatmap/heatmap.py b/examples/heatmap/heatmap.py index 39d76ae4e..38c9b51a7 100644 --- a/examples/heatmap/heatmap.py +++ b/examples/heatmap/heatmap.py @@ -26,8 +26,8 @@ figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/image/image_cmap.py b/examples/image/image_cmap.py index 99a3c1969..f651f438c 100644 --- a/examples/image/image_cmap.py +++ b/examples/image/image_cmap.py @@ -22,8 +22,8 @@ image_graphic.cmap = "viridis" -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/image/image_rgb.py b/examples/image/image_rgb.py index 5af8cee0d..187dac553 100644 --- a/examples/image/image_rgb.py +++ b/examples/image/image_rgb.py @@ -21,8 +21,8 @@ figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/image/image_rgbvminvmax.py b/examples/image/image_rgbvminvmax.py index 08c01a36e..02635f134 100644 --- a/examples/image/image_rgbvminvmax.py +++ b/examples/image/image_rgbvminvmax.py @@ -23,8 +23,8 @@ image_graphic.vmin = 0.5 image_graphic.vmax = 0.75 -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/image/image_simple.py b/examples/image/image_simple.py index 31803f2f8..d0910fb82 100644 --- a/examples/image/image_simple.py +++ b/examples/image/image_simple.py @@ -20,9 +20,8 @@ figure.show() - -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/image/image_small.py b/examples/image/image_small.py index eebc49797..732d61d74 100644 --- a/examples/image/image_small.py +++ b/examples/image/image_small.py @@ -22,9 +22,8 @@ figure.show() - -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/image/image_vminvmax.py b/examples/image/image_vminvmax.py index 6cf13834d..e2d1c7743 100644 --- a/examples/image/image_vminvmax.py +++ b/examples/image/image_vminvmax.py @@ -23,8 +23,8 @@ image_graphic.vmin = 0.5 image_graphic.vmax = 0.75 -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/image_widget/image_widget.py b/examples/image_widget/image_widget.py index 4fe47b7fe..a3c332182 100644 --- a/examples/image_widget/image_widget.py +++ b/examples/image_widget/image_widget.py @@ -27,8 +27,8 @@ 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 +# 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() diff --git a/examples/image_widget/image_widget_grid.py b/examples/image_widget/image_widget_grid.py index f52f38bc5..41e964e95 100644 --- a/examples/image_widget/image_widget_grid.py +++ b/examples/image_widget/image_widget_grid.py @@ -34,8 +34,8 @@ subplot.toolbar = False -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/image_widget/image_widget_single_video.py b/examples/image_widget/image_widget_single_video.py index aa601d3c1..86ca642fa 100644 --- a/examples/image_widget/image_widget_single_video.py +++ b/examples/image_widget/image_widget_single_video.py @@ -40,8 +40,8 @@ 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 +# 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() diff --git a/examples/image_widget/image_widget_videos.py b/examples/image_widget/image_widget_videos.py index 7de4a9c04..399abbcff 100644 --- a/examples/image_widget/image_widget_videos.py +++ b/examples/image_widget/image_widget_videos.py @@ -36,8 +36,8 @@ 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 +# 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() diff --git a/examples/image_widget/image_widget_viewports_check.py b/examples/image_widget/image_widget_viewports_check.py index 057134341..a4c0aea03 100644 --- a/examples/image_widget/image_widget_viewports_check.py +++ b/examples/image_widget/image_widget_viewports_check.py @@ -28,8 +28,8 @@ 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 +# 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() diff --git a/examples/line/line.py b/examples/line/line.py index c460c84ac..fb8834759 100644 --- a/examples/line/line.py +++ b/examples/line/line.py @@ -40,8 +40,8 @@ figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/line/line_cmap.py b/examples/line/line_cmap.py index b2fb39779..af24f1c63 100644 --- a/examples/line/line_cmap.py +++ b/examples/line/line_cmap.py @@ -42,8 +42,8 @@ figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/line/line_cmap_more.py b/examples/line/line_cmap_more.py index 37fd68cdb..c7c0d80f4 100644 --- a/examples/line/line_cmap_more.py +++ b/examples/line/line_cmap_more.py @@ -49,8 +49,8 @@ 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 +# 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() diff --git a/examples/line/line_colorslice.py b/examples/line/line_colorslice.py index 788aa342d..2d4c0dcaa 100644 --- a/examples/line/line_colorslice.py +++ b/examples/line/line_colorslice.py @@ -83,8 +83,8 @@ zeros_graphic.cmap[75:] = "viridis" -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/line/line_dataslice.py b/examples/line/line_dataslice.py index 92f33a109..ca0f48518 100644 --- a/examples/line/line_dataslice.py +++ b/examples/line/line_dataslice.py @@ -47,8 +47,8 @@ sinc_graphic.data[bool_key, 1] = 7 # y vals to 1 -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/line_collection/line_collection.py b/examples/line_collection/line_collection.py index 75b56e61e..2ddfbe2ed 100644 --- a/examples/line_collection/line_collection.py +++ b/examples/line_collection/line_collection.py @@ -29,7 +29,7 @@ def make_circle(center, radius: float, n_points: int = 75) -> np.ndarray: pos_xy = np.vstack(circles) -figure = fpl.Figure(size=(700, 560)) +figure = fpl.Figure(size=(700, 560), show_tooltips=True) figure[0, 0].add_line_collection(circles, cmap="jet", thickness=5) @@ -39,8 +39,8 @@ def make_circle(center, radius: float, n_points: int = 75) -> np.ndarray: figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/line_collection/line_collection_cmap_values.py b/examples/line_collection/line_collection_cmap_values.py index c577609f9..59f456893 100644 --- a/examples/line_collection/line_collection_cmap_values.py +++ b/examples/line_collection/line_collection_cmap_values.py @@ -46,8 +46,8 @@ def make_circle(center, radius: float, n_points: int = 75) -> np.ndarray: figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/line_collection/line_collection_cmap_values_qualitative.py b/examples/line_collection/line_collection_cmap_values_qualitative.py index 7b1c0a419..399f4a93d 100644 --- a/examples/line_collection/line_collection_cmap_values_qualitative.py +++ b/examples/line_collection/line_collection_cmap_values_qualitative.py @@ -56,8 +56,8 @@ def make_circle(center, radius: float, n_points: int = 75) -> np.ndarray: figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/line_collection/line_collection_colors.py b/examples/line_collection/line_collection_colors.py index 1d9eff45d..b7b25e853 100644 --- a/examples/line_collection/line_collection_colors.py +++ b/examples/line_collection/line_collection_colors.py @@ -43,8 +43,8 @@ def make_circle(center, radius: float, n_points: int = 75) -> np.ndarray: figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/line_collection/line_stack.py b/examples/line_collection/line_stack.py index 4f0c6037d..829708cb7 100644 --- a/examples/line_collection/line_stack.py +++ b/examples/line_collection/line_stack.py @@ -54,8 +54,8 @@ def tooltip_info(ev): 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 +# 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() diff --git a/examples/line_collection/line_stack_3d.py b/examples/line_collection/line_stack_3d.py index 35fe48ca9..b4548c1c6 100644 --- a/examples/line_collection/line_stack_3d.py +++ b/examples/line_collection/line_stack_3d.py @@ -101,8 +101,8 @@ def animate_colors(subplot): figure[0, 0].camera.set_state(camera_state) -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/machine_learning/covariance.py b/examples/machine_learning/covariance.py index 84c5bf531..d918cb6b4 100644 --- a/examples/machine_learning/covariance.py +++ b/examples/machine_learning/covariance.py @@ -14,7 +14,7 @@ from sklearn.preprocessing import StandardScaler # load faces dataset -faces = datasets.fetch_olivetti_faces() +faces = datasets.fetch_olivetti_faces(n_retries=5, delay=20) data = faces["data"] # sort the data so it's easier to understand the covariance matrix @@ -87,8 +87,8 @@ def animate(): iw.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/machine_learning/kmeans.py b/examples/machine_learning/kmeans.py index 0aae8fdae..f571882ce 100644 --- a/examples/machine_learning/kmeans.py +++ b/examples/machine_learning/kmeans.py @@ -118,8 +118,8 @@ def update(ev): figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() \ No newline at end of file diff --git a/examples/misc/cycle_animation.py b/examples/misc/cycle_animation.py index e369b957c..833321453 100644 --- a/examples/misc/cycle_animation.py +++ b/examples/misc/cycle_animation.py @@ -54,8 +54,8 @@ def cycle_colors(subplot): figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/misc/em_wave_animation.py b/examples/misc/em_wave_animation.py index 06c60ccaf..f2b9f8de5 100644 --- a/examples/misc/em_wave_animation.py +++ b/examples/misc/em_wave_animation.py @@ -108,8 +108,8 @@ def tick(subplot): figure[0, 0].add_animations(tick) print(figure[0, 0]._fpl_graphics_scene.children) -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/misc/image_animation.py b/examples/misc/image_animation.py index bc5f83957..1f7ff6109 100644 --- a/examples/misc/image_animation.py +++ b/examples/misc/image_animation.py @@ -30,8 +30,8 @@ def update_data(figure_instance): figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/misc/line3d_animation.py b/examples/misc/line3d_animation.py index b26bfd3a0..c1d903e02 100644 --- a/examples/misc/line3d_animation.py +++ b/examples/misc/line3d_animation.py @@ -54,8 +54,8 @@ def move_marker(): figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/misc/line_animation.py b/examples/misc/line_animation.py index 07c6a7d94..86448a78b 100644 --- a/examples/misc/line_animation.py +++ b/examples/misc/line_animation.py @@ -43,8 +43,8 @@ def update_line(subplot): 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 +# 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() diff --git a/examples/misc/lorenz_animation.py b/examples/misc/lorenz_animation.py index 4d4c5129f..20aee5d83 100644 --- a/examples/misc/lorenz_animation.py +++ b/examples/misc/lorenz_animation.py @@ -86,8 +86,8 @@ def animate(subplot): # set initial camera position to make animation in gallery render better figure[0, 0].camera.world.z = 80 -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/misc/multiplot_animation.py b/examples/misc/multiplot_animation.py index 4eb9399f8..789ce744e 100644 --- a/examples/misc/multiplot_animation.py +++ b/examples/misc/multiplot_animation.py @@ -41,8 +41,8 @@ def update_data(f): figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/misc/scatter_animation.py b/examples/misc/scatter_animation.py index d85a33e6a..ee8d2a10a 100644 --- a/examples/misc/scatter_animation.py +++ b/examples/misc/scatter_animation.py @@ -51,8 +51,8 @@ def update_points(subplot): figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/misc/scatter_sizes_animation.py b/examples/misc/scatter_sizes_animation.py index 45782564d..53a616a68 100644 --- a/examples/misc/scatter_sizes_animation.py +++ b/examples/misc/scatter_sizes_animation.py @@ -40,8 +40,8 @@ def update_sizes(subplot): 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 +# 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() diff --git a/examples/misc/tooltips.py b/examples/misc/tooltips.py index 4fdae1482..cad3d807c 100644 --- a/examples/misc/tooltips.py +++ b/examples/misc/tooltips.py @@ -47,8 +47,8 @@ # 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 +# 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() diff --git a/examples/scatter/scatter.py b/examples/scatter/scatter.py index afb0a0b81..838199ecb 100644 --- a/examples/scatter/scatter.py +++ b/examples/scatter/scatter.py @@ -41,8 +41,8 @@ figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/scatter/scatter_cmap.py b/examples/scatter/scatter_cmap.py index 8810e3d7b..3c7bd0e21 100644 --- a/examples/scatter/scatter_cmap.py +++ b/examples/scatter/scatter_cmap.py @@ -43,8 +43,8 @@ figure[0, 0].graphics[0].cmap = "viridis" -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/scatter/scatter_colorslice.py b/examples/scatter/scatter_colorslice.py index cf7472361..a3cacee55 100644 --- a/examples/scatter/scatter_colorslice.py +++ b/examples/scatter/scatter_colorslice.py @@ -46,8 +46,8 @@ scatter_graphic.colors[75:150] = "white" scatter_graphic.colors[::2] = "blue" -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/scatter/scatter_dataslice.py b/examples/scatter/scatter_dataslice.py index 840553237..7a30d6f70 100644 --- a/examples/scatter/scatter_dataslice.py +++ b/examples/scatter/scatter_dataslice.py @@ -32,8 +32,8 @@ scatter1.data[:500] = np.array([0 , 0, 0]) scatter2.data[500:] = np.array([0 , 0, 0]) -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/scatter/scatter_iris.py b/examples/scatter/scatter_iris.py index e000d5a0a..94c8acca1 100644 --- a/examples/scatter/scatter_iris.py +++ b/examples/scatter/scatter_iris.py @@ -28,8 +28,8 @@ figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/scatter/scatter_size.py b/examples/scatter/scatter_size.py index c982e0220..30d3e6ea3 100644 --- a/examples/scatter/scatter_size.py +++ b/examples/scatter/scatter_size.py @@ -43,8 +43,8 @@ figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/scatter/spinning_spiral.py b/examples/scatter/spinning_spiral.py index 56cdcb906..80e893301 100644 --- a/examples/scatter/spinning_spiral.py +++ b/examples/scatter/spinning_spiral.py @@ -79,8 +79,8 @@ def update(): figure.imgui_show_fps = True -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/selection_tools/fft.py b/examples/selection_tools/fft.py index f249f2c11..46ab8f89f 100644 --- a/examples/selection_tools/fft.py +++ b/examples/selection_tools/fft.py @@ -94,8 +94,8 @@ def update_images(ev): 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 +# 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() diff --git a/examples/selection_tools/linear_region_line_collection.py b/examples/selection_tools/linear_region_line_collection.py index 4b85b34dc..05084df0f 100644 --- a/examples/selection_tools/linear_region_line_collection.py +++ b/examples/selection_tools/linear_region_line_collection.py @@ -77,8 +77,8 @@ def update_zoomed_subplots(ev): 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 +# 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() diff --git a/examples/selection_tools/linear_region_selector.py b/examples/selection_tools/linear_region_selector.py index 272623370..5c6d6e01b 100644 --- a/examples/selection_tools/linear_region_selector.py +++ b/examples/selection_tools/linear_region_selector.py @@ -107,8 +107,8 @@ def set_zoom_y(ev): 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 +# 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() diff --git a/examples/selection_tools/linear_region_selectors_match_offsets.py b/examples/selection_tools/linear_region_selectors_match_offsets.py index a803a5e75..7ac9cc486 100644 --- a/examples/selection_tools/linear_region_selectors_match_offsets.py +++ b/examples/selection_tools/linear_region_selectors_match_offsets.py @@ -102,8 +102,8 @@ def set_zoom_y(ev): 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 +# 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() diff --git a/examples/selection_tools/linear_selector.py b/examples/selection_tools/linear_selector.py index d7a8e6739..65fd8f1b1 100644 --- a/examples/selection_tools/linear_selector.py +++ b/examples/selection_tools/linear_selector.py @@ -115,8 +115,8 @@ def line_stack_selector_changed(ev): 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 +# 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() diff --git a/examples/selection_tools/linear_selector_image.py b/examples/selection_tools/linear_selector_image.py index 00484aba7..04844b568 100644 --- a/examples/selection_tools/linear_selector_image.py +++ b/examples/selection_tools/linear_selector_image.py @@ -66,8 +66,8 @@ def image_col_selector_changed(ev): subplot.camera.zoom = 0.5 -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/selection_tools/rectangle_selector.py b/examples/selection_tools/rectangle_selector.py index 850937f7a..d0fd33aa9 100644 --- a/examples/selection_tools/rectangle_selector.py +++ b/examples/selection_tools/rectangle_selector.py @@ -59,8 +59,8 @@ def color_indices(ev): figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/selection_tools/rectangle_selector_zoom.py b/examples/selection_tools/rectangle_selector_zoom.py index 33ba2ae2a..61e38ffc9 100644 --- a/examples/selection_tools/rectangle_selector_zoom.py +++ b/examples/selection_tools/rectangle_selector_zoom.py @@ -46,8 +46,8 @@ def update_data(ev): figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/selection_tools/unit_circle.py b/examples/selection_tools/unit_circle.py index 2850b1bc1..b068d1bc7 100644 --- a/examples/selection_tools/unit_circle.py +++ b/examples/selection_tools/unit_circle.py @@ -135,8 +135,8 @@ def set_x_val(ev): figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/text/moving_label.py b/examples/text/moving_label.py index 45d2439ee..7ba7d85df 100644 --- a/examples/text/moving_label.py +++ b/examples/text/moving_label.py @@ -77,8 +77,8 @@ def update(): 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 +# 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() diff --git a/examples/window_layouts/extent_frac_layout.py b/examples/window_layouts/extent_frac_layout.py index 0c5293e09..d90270c22 100644 --- a/examples/window_layouts/extent_frac_layout.py +++ b/examples/window_layouts/extent_frac_layout.py @@ -67,8 +67,8 @@ figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/window_layouts/extent_layout.py b/examples/window_layouts/extent_layout.py index e6facaaa2..341a2f970 100644 --- a/examples/window_layouts/extent_layout.py +++ b/examples/window_layouts/extent_layout.py @@ -67,8 +67,8 @@ figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/window_layouts/rect_frac_layout.py b/examples/window_layouts/rect_frac_layout.py index 072fa1107..070488487 100644 --- a/examples/window_layouts/rect_frac_layout.py +++ b/examples/window_layouts/rect_frac_layout.py @@ -67,8 +67,8 @@ figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/examples/window_layouts/rect_layout.py b/examples/window_layouts/rect_layout.py index 962b8a4f1..c9fa23a0e 100644 --- a/examples/window_layouts/rect_layout.py +++ b/examples/window_layouts/rect_layout.py @@ -67,8 +67,8 @@ figure.show() -# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively -# please see our docs for using fastplotlib interactively in ipython and jupyter +# 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() diff --git a/fastplotlib/graphics/_base.py b/fastplotlib/graphics/_base.py index e115107b0..bc3486696 100644 --- a/fastplotlib/graphics/_base.py +++ b/fastplotlib/graphics/_base.py @@ -204,12 +204,6 @@ def _set_world_object(self, wo: pygfx.WorldObject): if not all(self.world_object.world.rotation == self.rotation): self.rotation = self.rotation - def unshare_property(self, feature: str): - raise NotImplementedError - - def share_property(self, feature: BufferManager): - raise NotImplementedError - @property def event_handlers(self) -> list[tuple[str, callable, ...]]: """ diff --git a/fastplotlib/graphics/_positions_base.py b/fastplotlib/graphics/_positions_base.py index 8b127aa19..4a4f5a797 100644 --- a/fastplotlib/graphics/_positions_base.py +++ b/fastplotlib/graphics/_positions_base.py @@ -153,53 +153,3 @@ def __init__( self._size_space = SizeSpace(size_space) super().__init__(*args, **kwargs) - - def unshare_property(self, property: str): - """unshare a shared property. Experimental and untested!""" - if not isinstance(property, str): - raise TypeError - - f = getattr(self, property) - if f.shared == 0: - raise BufferError("Cannot detach an independent buffer") - - if property == "colors" and isinstance(property, VertexColors): - self._colors._buffer = pygfx.Buffer(self._colors.value.copy()) - self.world_object.geometry.colors = self._colors.buffer - self._colors._shared -= 1 - - elif property == "data": - self._data._buffer = pygfx.Buffer(self._data.value.copy()) - self.world_object.geometry.positions = self._data.buffer - self._data._shared -= 1 - - elif property == "sizes": - self._sizes._buffer = pygfx.Buffer(self._sizes.value.copy()) - self.world_object.geometry.positions = self._sizes.buffer - self._sizes._shared -= 1 - - def share_property( - self, property: VertexPositions | VertexColors | PointsSizesFeature - ): - """share a property from another graphic. Experimental and untested!""" - if isinstance(property, VertexPositions): - # TODO: check if this causes a memory leak - self._data._shared -= 1 - - self._data = property - self._data._shared += 1 - self.world_object.geometry.positions = self._data.buffer - - elif isinstance(property, VertexColors): - self._colors._shared -= 1 - - self._colors = property - self._colors._shared += 1 - self.world_object.geometry.colors = self._colors.buffer - - elif isinstance(property, PointsSizesFeature): - self._sizes._shared -= 1 - - self._sizes = property - self._sizes._shared += 1 - self.world_object.geometry.sizes = self._sizes.buffer diff --git a/fastplotlib/graphics/image.py b/fastplotlib/graphics/image.py index b2a8048b3..957607fe1 100644 --- a/fastplotlib/graphics/image.py +++ b/fastplotlib/graphics/image.py @@ -123,7 +123,7 @@ def __init__( array is large. kwargs: - additional keyword arguments passed to Graphic + additional keyword arguments passed to :class:`.Graphic` """ diff --git a/fastplotlib/graphics/line.py b/fastplotlib/graphics/line.py index ab5b94146..4cdc7f413 100644 --- a/fastplotlib/graphics/line.py +++ b/fastplotlib/graphics/line.py @@ -76,7 +76,7 @@ def __init__( coordinate space in which the thickness is expressed ("screen", "world", "model") **kwargs - passed to Graphic + passed to :class:`.Graphic` """ diff --git a/fastplotlib/graphics/scatter.py b/fastplotlib/graphics/scatter.py index 7fd09ffca..b31022f5b 100644 --- a/fastplotlib/graphics/scatter.py +++ b/fastplotlib/graphics/scatter.py @@ -81,7 +81,7 @@ def __init__( coordinate space in which the size is expressed ("screen", "world", "model") kwargs - passed to Graphic + passed to :class:`.Graphic` """ diff --git a/fastplotlib/graphics/selectors/_base_selector.py b/fastplotlib/graphics/selectors/_base_selector.py index b74bcf759..5cef0c6b0 100644 --- a/fastplotlib/graphics/selectors/_base_selector.py +++ b/fastplotlib/graphics/selectors/_base_selector.py @@ -323,7 +323,7 @@ def _move(self, ev): # if it was disabled, keep it disabled self._plot_area.controller.enabled = self._initial_controller_state - def _move_graphic(self, delta: np.ndarray): + def _move_graphic(self, move_info: MoveInfo): raise NotImplementedError("Must be implemented in subclass") def _move_end(self, ev): @@ -384,8 +384,9 @@ def _move_to_pointer(self, ev): # else use an edge, such as for linear selector else: move_info = MoveInfo( - start_position=current_pos_world, - last_position=current_pos_world, + start_position=None, + start_selection=None, + delta=delta, source=self._edges[0], ) diff --git a/fastplotlib/graphics/selectors/_linear_region.py b/fastplotlib/graphics/selectors/_linear_region.py index 14160b10c..e93e2a147 100644 --- a/fastplotlib/graphics/selectors/_linear_region.py +++ b/fastplotlib/graphics/selectors/_linear_region.py @@ -381,7 +381,7 @@ def _move_graphic(self, move_info: MoveInfo): cur_min, cur_max = move_info.start_selection # move entire selector if event source was fill - if self._move_info.source == self.fill: + if move_info.source == self.fill: # Limit the delta to avoid weird resizine behavior min_delta = self.limits[0] - cur_min max_delta = self.limits[1] - cur_max @@ -396,12 +396,12 @@ def _move_graphic(self, move_info: MoveInfo): # if event source was an edge and selector is resizable, # move the edge that caused the event - if self._move_info.source == self.edges[0]: + if move_info.source == self.edges[0]: # change only left or bottom bound new_min = min(cur_min + delta, cur_max) self._selection.set_value(self, (new_min, cur_max)) - elif self._move_info.source == self.edges[1]: + elif move_info.source == self.edges[1]: # change only right or top bound new_max = max(cur_max + delta, cur_min) self._selection.set_value(self, (cur_min, new_max)) diff --git a/fastplotlib/graphics/selectors/_rectangle.py b/fastplotlib/graphics/selectors/_rectangle.py index e3dd3887e..db7691e07 100644 --- a/fastplotlib/graphics/selectors/_rectangle.py +++ b/fastplotlib/graphics/selectors/_rectangle.py @@ -491,7 +491,7 @@ def _move_graphic(self, move_info: MoveInfo): xmin, xmax, ymin, ymax = move_info.start_selection # move entire selector if source is fill - if self._move_info.source == self.fill: + if move_info.source == self.fill: # Limit the delta to avoid weird resizine behavior min_deltax = self.limits[0] - xmin max_deltax = self.limits[1] - xmax @@ -514,22 +514,22 @@ def _move_graphic(self, move_info: MoveInfo): ymin_new = min(ymin + deltay, ymax) ymax_new = max(ymax + deltay, ymin) - if self._move_info.source == self.vertices[0]: # bottom left + if move_info.source == self.vertices[0]: # bottom left self._selection.set_value(self, (xmin_new, xmax, ymin_new, ymax)) - if self._move_info.source == self.vertices[1]: # bottom right + if move_info.source == self.vertices[1]: # bottom right self._selection.set_value(self, (xmin, xmax_new, ymin_new, ymax)) - if self._move_info.source == self.vertices[2]: # top left + if move_info.source == self.vertices[2]: # top left self._selection.set_value(self, (xmin_new, xmax, ymin, ymax_new)) - if self._move_info.source == self.vertices[3]: # top right + if move_info.source == self.vertices[3]: # top right self._selection.set_value(self, (xmin, xmax_new, ymin, ymax_new)) # if event source was an edge and selector is resizable, move the edge that caused the event - if self._move_info.source == self.edges[0]: + if move_info.source == self.edges[0]: self._selection.set_value(self, (xmin_new, xmax, ymin, ymax)) - if self._move_info.source == self.edges[1]: + if move_info.source == self.edges[1]: self._selection.set_value(self, (xmin, xmax_new, ymin, ymax)) - if self._move_info.source == self.edges[2]: + if move_info.source == self.edges[2]: self._selection.set_value(self, (xmin, xmax, ymin_new, ymax)) - if self._move_info.source == self.edges[3]: + if move_info.source == self.edges[3]: self._selection.set_value(self, (xmin, xmax, ymin, ymax_new)) def _move_to_pointer(self, ev): diff --git a/fastplotlib/graphics/text.py b/fastplotlib/graphics/text.py index fba3962ad..fd0e9d702 100644 --- a/fastplotlib/graphics/text.py +++ b/fastplotlib/graphics/text.py @@ -66,7 +66,7 @@ def __init__( * Horizontal values: "left", "center", "right" **kwargs - passed to Graphic + passed to :class:`.Graphic` """ diff --git a/fastplotlib/layouts/_graphic_methods_mixin.py b/fastplotlib/layouts/_graphic_methods_mixin.py index f2595923f..cb9cd04c0 100644 --- a/fastplotlib/layouts/_graphic_methods_mixin.py +++ b/fastplotlib/layouts/_graphic_methods_mixin.py @@ -67,7 +67,7 @@ def add_image( array is large. kwargs: - additional keyword arguments passed to Graphic + additional keyword arguments passed to :class:`.Graphic` """ @@ -225,7 +225,7 @@ def add_line( coordinate space in which the thickness is expressed ("screen", "world", "model") **kwargs - passed to Graphic + passed to :class:`.Graphic` """ @@ -401,7 +401,7 @@ def add_scatter( coordinate space in which the size is expressed ("screen", "world", "model") kwargs - passed to Graphic + passed to :class:`.Graphic` """ @@ -467,7 +467,7 @@ def add_text( * Horizontal values: "left", "center", "right" **kwargs - passed to Graphic + passed to :class:`.Graphic` """ diff --git a/fastplotlib/widgets/image_widget/_widget.py b/fastplotlib/widgets/image_widget/_widget.py index b3fe1d05d..650097951 100644 --- a/fastplotlib/widgets/image_widget/_widget.py +++ b/fastplotlib/widgets/image_widget/_widget.py @@ -942,8 +942,10 @@ def set_data( # make new graphic first new_graphic = ImageGraphic(data=frame, name="image_widget_managed") - # set hlut tool to use new graphic - subplot.docks["right"]["histogram_lut"].image_graphic = new_graphic + if self._histogram_widget: + # set hlut tool to use new graphic + subplot.docks["right"]["histogram_lut"].image_graphic = new_graphic + # delete old graphic after setting hlut tool to new graphic # this ensures gc subplot.delete_graphic(graphic=subplot["image_widget_managed"])