From 005125149889be59a6cbeec5e6103bb2bff2501e Mon Sep 17 00:00:00 2001 From: Kushal Kolar Date: Mon, 2 Jun 2025 09:28:53 -0400 Subject: [PATCH 1/7] fix (#851) --- fastplotlib/widgets/image_widget/_widget.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fastplotlib/widgets/image_widget/_widget.py b/fastplotlib/widgets/image_widget/_widget.py index b3fe1d05..65009795 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"]) From 433ecc3908ebafc685cc8b3783c439f37d4c99dd Mon Sep 17 00:00:00 2001 From: Kushal Kolar Date: Mon, 2 Jun 2025 09:30:12 -0400 Subject: [PATCH 2/7] add github button to docs (#845) --- docs/source/conf.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 8d17c97a..52d71ab1 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -105,7 +105,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"] From 70c9e0443eb23042c41c6c97b86c8dd8fc82c293 Mon Sep 17 00:00:00 2001 From: Kushal Kolar Date: Mon, 2 Jun 2025 09:30:45 -0400 Subject: [PATCH 3/7] retry sklearn datset downloads (#844) --- examples/events/scatter_hover_transforms.py | 2 +- examples/machine_learning/covariance.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/events/scatter_hover_transforms.py b/examples/events/scatter_hover_transforms.py index 7f9fbb9f..69ca4edd 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 diff --git a/examples/machine_learning/covariance.py b/examples/machine_learning/covariance.py index 84c5bf53..f51167df 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 From e648f0522946e9ef2d81ecd15c49778d306dbd33 Mon Sep 17 00:00:00 2001 From: Kushal Kolar Date: Mon, 2 Jun 2025 09:31:21 -0400 Subject: [PATCH 4/7] Update docstrings (#841) * link to Graphic in docstrings * update mixin --- fastplotlib/graphics/image.py | 2 +- fastplotlib/graphics/line.py | 2 +- fastplotlib/graphics/scatter.py | 2 +- fastplotlib/graphics/text.py | 2 +- fastplotlib/layouts/_graphic_methods_mixin.py | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fastplotlib/graphics/image.py b/fastplotlib/graphics/image.py index b2a8048b..957607fe 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 ab5b9414..4cdc7f41 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 7fd09ffc..b31022f5 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/text.py b/fastplotlib/graphics/text.py index fba3962a..fd0e9d70 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 f2595923..cb9cd04c 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` """ From 15ab65fc7bcdb4041773b79392113415b774f1ec Mon Sep 17 00:00:00 2001 From: Kushal Kolar Date: Mon, 2 Jun 2025 09:32:51 -0400 Subject: [PATCH 5/7] remove `Graphic.share_property()` and `unshare_property()` (#842) * remove share_property() and unshare_property() * update api docs --- docs/source/api/graphics/Graphic.rst | 2 - docs/source/api/graphics/ImageGraphic.rst | 2 - docs/source/api/graphics/LineCollection.rst | 2 - docs/source/api/graphics/LineGraphic.rst | 2 - docs/source/api/graphics/LineStack.rst | 2 - docs/source/api/graphics/ScatterGraphic.rst | 2 - docs/source/api/graphics/TextGraphic.rst | 2 - .../api/selectors/LinearRegionSelector.rst | 2 - docs/source/api/selectors/LinearSelector.rst | 2 - .../api/selectors/RectangleSelector.rst | 2 - docs/source/api/tools/HistogramLUTTool.rst | 2 - fastplotlib/graphics/_base.py | 6 --- fastplotlib/graphics/_positions_base.py | 50 ------------------- 13 files changed, 78 deletions(-) diff --git a/docs/source/api/graphics/Graphic.rst b/docs/source/api/graphics/Graphic.rst index 08ab0404..cf68888f 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 dd5ff1cc..27bda3d3 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 ad4b7f92..12c7b5c9 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 4302ab56..c6e18b41 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 db060a4c..e1deb75a 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 83e734c6..968f0e09 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 2a55d78e..60cd97f4 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 6c8d2eef..2c23bc82 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 b82e3c1d..c7a8e978 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 81c9afd6..24928c81 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 d134eb1c..7c323749 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/fastplotlib/graphics/_base.py b/fastplotlib/graphics/_base.py index e115107b..bc348669 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 8b127aa1..4a4f5a79 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 From 09db45dcc79227745cc76d73ee800de43a7b0795 Mon Sep 17 00:00:00 2001 From: Kushal Kolar Date: Mon, 2 Jun 2025 13:07:24 -0400 Subject: [PATCH 6/7] better docs on use in jupyterlab and ipython (#843) * betters on use in jupyterlab and ipython * unintended change to afile * unintended change to another file * more unintended change to another file * better explanation * see if this works to remove jupyter nb download button in gallery * clearer * heading underline * comment * Update docs/source/user_guide/guide.rst Co-authored-by: Caitlin Lewis <69729525+clewis7@users.noreply.github.com> --------- Co-authored-by: Caitlin Lewis <69729525+clewis7@users.noreply.github.com> --- docs/source/conf.py | 1 + docs/source/user_guide/guide.rst | 67 ++++++++++++++----- examples/controllers/specify_integers.py | 4 +- examples/controllers/specify_names.py | 4 +- examples/controllers/sync_all.py | 4 +- examples/events/cmap_event.py | 4 +- examples/events/drag_points.py | 4 +- examples/events/image_click.py | 4 +- examples/events/image_data_event.py | 4 +- examples/events/key_events.py | 4 +- examples/events/line_data_thickness_event.py | 4 +- examples/events/lines_mouse_nearest.py | 4 +- examples/events/paint_image.py | 4 +- examples/events/scatter_click.py | 4 +- examples/events/scatter_hover.py | 4 +- examples/events/scatter_hover_transforms.py | 4 +- examples/gridplot/gridplot.py | 4 +- examples/gridplot/gridplot_non_square.py | 4 +- examples/gridplot/gridplot_viewports_check.py | 4 +- examples/gridplot/multigraphic_gridplot.py | 4 +- examples/guis/image_widget_imgui.py | 4 +- examples/guis/imgui_basic.py | 4 +- examples/guis/sine_cosine_funcs.py | 4 +- examples/heatmap/heatmap.py | 4 +- examples/image/image_cmap.py | 4 +- examples/image/image_rgb.py | 4 +- examples/image/image_rgbvminvmax.py | 4 +- examples/image/image_simple.py | 5 +- examples/image/image_small.py | 5 +- examples/image/image_vminvmax.py | 4 +- examples/image_widget/image_widget.py | 4 +- examples/image_widget/image_widget_grid.py | 4 +- .../image_widget/image_widget_single_video.py | 4 +- examples/image_widget/image_widget_videos.py | 4 +- .../image_widget_viewports_check.py | 4 +- examples/line/line.py | 4 +- examples/line/line_cmap.py | 4 +- examples/line/line_cmap_more.py | 4 +- examples/line/line_colorslice.py | 4 +- examples/line/line_dataslice.py | 4 +- examples/line_collection/line_collection.py | 6 +- .../line_collection_cmap_values.py | 4 +- ...line_collection_cmap_values_qualitative.py | 4 +- .../line_collection/line_collection_colors.py | 4 +- examples/line_collection/line_stack.py | 4 +- examples/line_collection/line_stack_3d.py | 4 +- examples/machine_learning/covariance.py | 4 +- examples/machine_learning/kmeans.py | 4 +- examples/misc/cycle_animation.py | 4 +- examples/misc/em_wave_animation.py | 4 +- examples/misc/image_animation.py | 4 +- examples/misc/line3d_animation.py | 4 +- examples/misc/line_animation.py | 4 +- examples/misc/lorenz_animation.py | 4 +- examples/misc/multiplot_animation.py | 4 +- examples/misc/scatter_animation.py | 4 +- examples/misc/scatter_sizes_animation.py | 4 +- examples/misc/tooltips.py | 4 +- examples/scatter/scatter.py | 4 +- examples/scatter/scatter_cmap.py | 4 +- examples/scatter/scatter_colorslice.py | 4 +- examples/scatter/scatter_dataslice.py | 4 +- examples/scatter/scatter_iris.py | 4 +- examples/scatter/scatter_size.py | 4 +- examples/scatter/spinning_spiral.py | 4 +- examples/selection_tools/fft.py | 4 +- .../linear_region_line_collection.py | 4 +- .../selection_tools/linear_region_selector.py | 4 +- .../linear_region_selectors_match_offsets.py | 4 +- examples/selection_tools/linear_selector.py | 4 +- .../selection_tools/linear_selector_image.py | 4 +- .../selection_tools/rectangle_selector.py | 4 +- .../rectangle_selector_zoom.py | 4 +- examples/selection_tools/unit_circle.py | 4 +- examples/text/moving_label.py | 4 +- examples/window_layouts/extent_frac_layout.py | 4 +- examples/window_layouts/extent_layout.py | 4 +- examples/window_layouts/rect_frac_layout.py | 4 +- examples/window_layouts/rect_layout.py | 4 +- 79 files changed, 206 insertions(+), 174 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 52d71ab1..e4ff7223 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",), diff --git a/docs/source/user_guide/guide.rst b/docs/source/user_guide/guide.rst index 073fa806..4f3dc64c 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 14b09b01..e74b9dd2 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 fb0539c4..0023651a 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 0683a882..3a1ee009 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 6cd68f33..62913cb2 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 9a91779d..752430c7 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 acb6cde3..729a6758 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 32f78996..f97b1115 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 6979d44d..f8cf2f3d 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 4baaba42..83f9322c 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 8c9601de..8d38e9f5 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 cfc2eda1..46ef4311 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 e56dca74..3bf85558 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 9d69dc24..c297223d 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 69ca4edd..18e6f3de 100644 --- a/examples/events/scatter_hover_transforms.py +++ b/examples/events/scatter_hover_transforms.py @@ -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 af4d8240..5edd6a84 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 e8ce15b7..da0bf14c 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 496204b9..45f9d700 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 8408f4f2..d89168ec 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 13d41af2..759d87a0 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 eac39121..26b5603c 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 c91a3b2e..09a5ec99 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 39d76ae4..38c9b51a 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 99a3c196..f651f438 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 5af8cee0..187dac55 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 08c01a36..02635f13 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 31803f2f..d0910fb8 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 eebc4979..732d61d7 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 6cf13834..e2d1c774 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 4fe47b7f..a3c33218 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 f52f38bc..41e964e9 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 aa601d3c..86ca642f 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 7de4a9c0..399abbcf 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 05713434..a4c0aea0 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 c460c84a..fb883475 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 b2fb3977..af24f1c6 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 37fd68cd..c7c0d80f 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 788aa342..2d4c0dca 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 92f33a10..ca0f4851 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 75b56e61..2ddfbe2e 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 c577609f..59f45689 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 7b1c0a41..399f4a93 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 1d9eff45..b7b25e85 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 4f0c6037..829708cb 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 35fe48ca..b4548c1c 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 f51167df..d918cb6b 100644 --- a/examples/machine_learning/covariance.py +++ b/examples/machine_learning/covariance.py @@ -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 0aae8fda..f571882c 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 e369b957..83332145 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 06c60cca..f2b9f8de 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 bc5f8395..1f7ff610 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 b26bfd3a..c1d903e0 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 07c6a7d9..86448a78 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 4d4c5129..20aee5d8 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 4eb9399f..789ce744 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 d85a33e6..ee8d2a10 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 45782564..53a616a6 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 4fdae148..cad3d807 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 afb0a0b8..838199ec 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 8810e3d7..3c7bd0e2 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 cf747236..a3cacee5 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 84055323..7a30d6f7 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 e000d5a0..94c8acca 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 c982e022..30d3e6ea 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 56cdcb90..80e89330 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 f249f2c1..46ab8f89 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 4b85b34d..05084df0 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 27262337..5c6d6e01 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 a803a5e7..7ac9cc48 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 d7a8e673..65fd8f1b 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 00484aba..04844b56 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 850937f7..d0fd33aa 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 33ba2ae2..61e38ffc 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 2850b1bc..b068d1bc 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 45d2439e..7ba7d85d 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 0c5293e0..d90270c2 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 e6facaaa..341a2f97 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 072fa110..07048848 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 962b8a4f..c9fa23a0 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() From 72a3f02a6442a85f6ab02542e70a880a5b90e4e4 Mon Sep 17 00:00:00 2001 From: Kushal Kolar Date: Wed, 11 Jun 2025 14:41:47 -0400 Subject: [PATCH 7/7] fix move to pointer for linear and linear region selector (#855) * fix move to pointer for liner and linear region selctor * Update fastplotlib/graphics/selectors/_base_selector.py --- .../graphics/selectors/_base_selector.py | 7 ++++--- .../graphics/selectors/_linear_region.py | 6 +++--- fastplotlib/graphics/selectors/_rectangle.py | 18 +++++++++--------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/fastplotlib/graphics/selectors/_base_selector.py b/fastplotlib/graphics/selectors/_base_selector.py index b74bcf75..5cef0c6b 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 14160b10..e93e2a14 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 e3dd3887..db7691e0 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):