You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 <[email protected]>
---------
Co-authored-by: Caitlin Lewis <[email protected]>
Copy file name to clipboardExpand all lines: docs/source/user_guide/guide.rst
+50-17Lines changed: 50 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -667,28 +667,61 @@ There are several spaces to consider when using ``fastplotlib``:
667
667
668
668
For more information on the various spaces used by rendering engines please see this `article <https://learnopengl.com/Getting-started/Coordinate-Systems>`_
669
669
670
-
Using ``fastplotlib`` in an interactive shell
671
-
---------------------------------------------
670
+
JupyterLab and IPython
671
+
----------------------
672
672
673
-
There are multiple ways to use ``fastplotlib`` in interactive shells, such as ipython.
673
+
In ``jupyter lab`` you have the option to embed ``Figures`` in regular output cells, on the side with ``sidecar``,
674
+
or show figures in separate Qt windows. Note: Once you have selected a display mode, we do not recommend switching to
675
+
a different display mode. Restart the kernel to reliably choose a different display mode. By default, fastplotlib
676
+
figures will be embedded in the notebook cell's output.
674
677
675
-
1) Jupyter
678
+
The `quickstart example notebook <https://github.com/fastplotlib/fastplotlib/blob/main/examples/notebooks/quickstart.ipynb>`_
679
+
is also a great place to start.
676
680
677
-
On ``jupyter lab`` the jupyter backend (i.e. ``jupyter_rfb``) is normally selected. This works via
678
-
client-server rendering. Images generated on the server are streamed to the client (Jupyter) via a jpeg byte stream.
679
-
Events (such as mouse or keyboard events) are then streamed in the opposite direction prompting new images to be generated
680
-
by the server if necessary. This remote-frame-buffer approach makes the rendering process very fast. ``fastplotlib`` viusalizations
681
-
can be displayed in cell output or on the side using ``sidecar``.
681
+
Notebooks and remote rendering
682
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
682
683
683
-
A Qt backend can also optionally be used as well. If ``%gui qt`` is selected before importing ``fastplotlib`` then this backend
684
-
will be used instead.
684
+
To display the ``Figure`` in the notebook output, the ``fig.show()`` call must be the last line in the code cell. Or
685
+
you can use ipython's display call: ``display(fig.show())``.
685
686
686
-
Lastly, users can also force using ``glfw`` by specifying this as an argument when instantiating a ``Figure`` (i.e. ``Figure(canvas="gflw"``).
687
+
To display the figure on the side: ``fig.show(sidecar=True)``
687
688
688
-
.. note::
689
-
Do not mix between gui backends. For example, if you start the notebook using Qt, do not attempt to force using another backend such
690
-
as ``jupyter_rfb`` later.
689
+
You can make use of all `ipywidget layout <https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Layout.html>`_
690
+
options to display multiple figures::
691
+
692
+
from ipywidgets import VBox, HBox
693
+
694
+
# stack figures vertically or horizontally
695
+
VBox([fig1.show(), fig2.show()])
696
+
697
+
Again the ``VBox([...])`` call must be the last line in the code cell, or you can use ``display(VBox([...]))``
698
+
699
+
You can combine ipywidget layouting just like any other ipywidget::
700
+
701
+
# display a figure on top of two figures laid out horizontally
702
+
703
+
VBox([
704
+
fig1.show(),
705
+
HBox([fig2.show(), fig3.show()])
706
+
])
707
+
708
+
Embedded figures will also render if you're using the notebook from a remote computer since rendering is done on the
709
+
server side and the client only receives a jpeg stream of rendered frames. This allows you to visualize very large
710
+
datasets on remote servers since the rendering is done remotely and you do not transfer any of the raw data to the
711
+
client.
712
+
713
+
You can create dashboards or webapps with ``fastplotlib`` by running the notebook with
714
+
`voila <https://github.com/voila-dashboards/voila>`_. This is great for sharing visualizations of very large datasets
715
+
that are too large to share over the internet, and creating fast interactive applications for the analysis of very
716
+
large datasets.
717
+
718
+
Qt windows in jupyter and IPython
719
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
691
720
692
-
2) IPython
721
+
Qt windows can also be used for displaying fastplotlib figures in an interactive jupyterlab or IPython. You must run
722
+
``%gui qt`` **before** importing ``fastplotlib`` (or ``wgpu``). This would typically be done at the very top of your
723
+
notebook.
693
724
694
-
Users can select between using a Qt backend or gflw using the same methods as above.
725
+
Note that this only works if you are using jupyterlab or ipython locally, this cannot be used for remote rendering.
726
+
You can forward windows (ex: X11 forwarding) but this is much slower than the remote rendering described in the
0 commit comments