:orphan:



.. _sphx_glr_gallery_scene:

Scene
=====

More example scripts are available in the VisPy repository's
`example scripts directory <https://github.com/vispy/vispy/tree/main/examples>`_.



.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Simple Line with Axis">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_axes_plot_thumb.png
     :alt: Simple Line with Axis

     :ref:`sphx_glr_gallery_scene_axes_plot.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/axes_plot

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Demonstration of borders and background colors">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_background_borders_thumb.png
     :alt: Demonstration of borders and background colors

     :ref:`sphx_glr_gallery_scene_background_borders.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/background_borders

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Simple use of SceneCanvas and ColorBarWidget to display a ColorBar">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_colorbar_widget_thumb.png
     :alt: Display a ColorBar

     :ref:`sphx_glr_gallery_scene_colorbar_widget.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/colorbar_widget

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Changing Line Colors">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_colored_line_thumb.gif
     :alt: Changing Line Colors

     :ref:`sphx_glr_gallery_scene_colored_line.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/colored_line

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Simple use of SceneCanvas to display an image consisting of complex numbers.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_complex_image_thumb.png
     :alt: Complex image data

     :ref:`sphx_glr_gallery_scene_complex_image.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/complex_image

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Demonstrate the use of the vispy console.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_console_thumb.png
     :alt: Vispy Console

     :ref:`sphx_glr_gallery_scene_console.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/console

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to visualise a NetworkX graph using a VisPy Graph.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_graph_thumb.gif
     :alt: Visualize NetworkX Graph

     :ref:`sphx_glr_gallery_scene_graph.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/graph

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Demonstration of InfiniteLine visual.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_infinite_line_thumb.png
     :alt: Draw an InfiniteLine

     :ref:`sphx_glr_gallery_scene_infinite_line.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/infinite_line

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="# this example is based on the tutorial: T01_basic_visual.py">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_instanced_quad_visual_thumb.png
     :alt: Custom Visual for instanced rendering of a colored quad

     :ref:`sphx_glr_gallery_scene_instanced_quad_visual.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/instanced_quad_visual

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Simple use of SceneCanvas to display an Isocurve visual.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_isocurve_thumb.png
     :alt: Display an Isocurve

     :ref:`sphx_glr_gallery_scene_isocurve.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/isocurve

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates isocurve for triangular mesh with vertex data.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_isocurve_for_trisurface_thumb.png
     :alt: Isocurve for Triangular Mesh

     :ref:`sphx_glr_gallery_scene_isocurve_for_trisurface.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/isocurve_for_trisurface

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates isocurve for triangular mesh with vertex data and a qt interface.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_isocurve_for_trisurface_qt_thumb.png
     :alt: Isocurve for Triangular Mesh with Qt Interface

     :ref:`sphx_glr_gallery_scene_isocurve_for_trisurface_qt.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/isocurve_for_trisurface_qt

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Show use of SceneCanvas to display and update Image and Isocurve visuals using ViewBox visual.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_isocurve_updates_thumb.gif
     :alt: Update Image and Isocurve Visuals

     :ref:`sphx_glr_gallery_scene_isocurve_updates.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/isocurve_updates

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates the use of the Isosurface visual.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_isosurface_thumb.png
     :alt: Isosurface Visual

     :ref:`sphx_glr_gallery_scene_isosurface.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/isosurface

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Demonstrate the use of lasso selection.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_lasso_thumb.png
     :alt: Vispy Lasso

     :ref:`sphx_glr_gallery_scene_lasso.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/lasso

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Simple demonstration of SceneCanvas containing a single line entity as its entire scenegraph.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_line_thumb.gif
     :alt: Draw a Line

     :ref:`sphx_glr_gallery_scene_line.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/line

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Demonstration of animated Line visual.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_line_update_thumb.gif
     :alt: Animated Line Visual

     :ref:`sphx_glr_gallery_scene_line_update.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/line_update

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Demonstration of LinearRegion visual. Allows drawing of infinite horizontal or vertical region ...">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_linear_region_thumb.png
     :alt: Draw an LinearRegion

     :ref:`sphx_glr_gallery_scene_linear_region.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/linear_region

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Demonstrates use of special Camera subclasses to implement a (flashy)  data-exploration tool.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_magnify_thumb.png
     :alt: Zoom in using MagnifyCamera

     :ref:`sphx_glr_gallery_scene_magnify.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/magnify

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Demonstrates how to identify (pick) markers. Hover markers to change their symbol and color.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_marker_picking_thumb.png
     :alt: Picking Markers

     :ref:`sphx_glr_gallery_scene_marker_picking.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/marker_picking

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Draw spherical Markers with Tube meshes connecting them.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_marker_spheres_thumb.png
     :alt: Spheres and Sticks

     :ref:`sphx_glr_gallery_scene_marker_spheres.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/marker_spheres

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Simple test of nested viewboxes, demonstrating the three methods that can be used by a viewbox ...">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_nested_viewbox_thumb.png
     :alt: Nested Viewboxes

     :ref:`sphx_glr_gallery_scene_nested_viewbox.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/nested_viewbox

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Demonstrates use of visual.Markers to create a point cloud with a standard turntable camera to ...">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_point_cloud_thumb.png
     :alt: Create a Point Cloud

     :ref:`sphx_glr_gallery_scene_point_cloud.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/point_cloud

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Demonstration of PolygonVisual, EllipseVisual, RectangleVisual and RegularPolygon">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_polygon_thumb.png
     :alt: Shape Visuals

     :ref:`sphx_glr_gallery_scene_polygon.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/polygon

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to create a sphere.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_save_animation_thumb.gif
     :alt: Create and Save Animation

     :ref:`sphx_glr_gallery_scene_save_animation.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/save_animation

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="For testing zoom sensitivity on various platforms">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_sensitivity_thumb.png
     :alt: Zoom Sensitivity

     :ref:`sphx_glr_gallery_scene_sensitivity.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/sensitivity

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Simple demonstration of drawing and editing shapes with the mouse This demo implements mouse pi...">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_shape_draw_thumb.png
     :alt: Draw and Edit Shapes with Mouse

     :ref:`sphx_glr_gallery_scene_shape_draw.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/shape_draw

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to create a sphere.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_sphere_thumb.png
     :alt: Draw a Sphere

     :ref:`sphx_glr_gallery_scene_sphere.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/sphere

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates the use of the SurfacePlot visual.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_surface_plot_thumb.png
     :alt: Draw a SurfacePlot

     :ref:`sphx_glr_gallery_scene_surface_plot.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/surface_plot

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Demonstrate the use of text in the root scene and a viewbox. Note how the point size is indepen...">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_text_thumb.png
     :alt: Text in a Scene and ViewBox

     :ref:`sphx_glr_gallery_scene_text.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/text

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Simple use of SceneCanvas to display a cube with an arcball camera.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_turntable_box_thumb.png
     :alt: Display a Cube

     :ref:`sphx_glr_gallery_scene_turntable_box.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/turntable_box

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Demonstrate ViewBox using various clipping methods.">

.. only:: html

 .. figure:: /gallery/scene/images/thumb/sphx_glr_viewbox_thumb.png
     :alt: ViewBox with Clipping Methods

     :ref:`sphx_glr_gallery_scene_viewbox.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/viewbox
.. raw:: html

    <div class="sphx-glr-clear"></div>



.. _sphx_glr_gallery_scene_grid_layout:

Grid Layouts
============

Examples of using the GridWidget to layout elements in a SceneCanvas.



.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Test automatic layout of multiple viewboxes using Grid.">

.. only:: html

 .. figure:: /gallery/scene/grid_layout/images/thumb/sphx_glr_grid_thumb.png
     :alt: Multiple ViewBoxes on a Grid

     :ref:`sphx_glr_gallery_scene_grid_layout_grid.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/grid_layout/grid

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" +-----+-----+ |     |     | |  1  |  2  | |     |     | +-----+-----+">

.. only:: html

 .. figure:: /gallery/scene/grid_layout/images/thumb/sphx_glr_grid_basic_thumb.png
     :alt: Simple use of a grid layout

     :ref:`sphx_glr_gallery_scene_grid_layout_grid_basic.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/grid_layout/grid_basic

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="::">

.. only:: html

 .. figure:: /gallery/scene/grid_layout/images/thumb/sphx_glr_grid_holed_thumb.png
     :alt: More complex grid layout

     :ref:`sphx_glr_gallery_scene_grid_layout_grid_holed.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/grid_layout/grid_holed

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Test automatic layout of multiple viewboxes using Grid.">

.. only:: html

 .. figure:: /gallery/scene/grid_layout/images/thumb/sphx_glr_grid_large_thumb.png
     :alt: Multiple Line Views on a Grid

     :ref:`sphx_glr_gallery_scene_grid_layout_grid_large.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/grid_layout/grid_large

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="+-----+-----+-----+ |  1  |  2  |  2  | +-----+-----+-----+ |  3  |  3  |  4  | +-----+-----+--...">

.. only:: html

 .. figure:: /gallery/scene/grid_layout/images/thumb/sphx_glr_grid_uneven_col_thumb.png
     :alt: Another Grid Layout

     :ref:`sphx_glr_gallery_scene_grid_layout_grid_uneven_col.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/grid_layout/grid_uneven_col

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="+----+-------------+ |    |             | | y  |   viewbox   | |    |             | +----+-----...">

.. only:: html

 .. figure:: /gallery/scene/grid_layout/images/thumb/sphx_glr_grid_x_y_viewbox_thumb.png
     :alt: Plot-like Grid Layout

     :ref:`sphx_glr_gallery_scene_grid_layout_grid_x_y_viewbox.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/grid_layout/grid_x_y_viewbox
.. raw:: html

    <div class="sphx-glr-clear"></div>



.. _sphx_glr_gallery_scene_realtime_data:

Realtime Data Tutorial
======================

Examples that progressively build a Qt-based visualization application
with updating data. The data in this tutorial is artificial, but is created
and used in a way resembling real world data streams. In early examples data
is created in the main GUI thread, but creation is later moved to an external
thread to promote better responsiveness from the GUI.

Each example is a self-contained working application in some sense and can be
used as a reference for the particular feature it is demonstrating. However,
each example builds on the example before it so features and
vispy application best practices are improved at the cost of more complex code.

Lastly, these examples use PySide2, but the application
structure and demonstrated concepts should apply and be transferable to other
backends (especially the Qt ones) with only a few exceptions. At the time of
writing PySide2 is the newest version of PySide available through conda-forge
conda channels. If/when PySide6 is available, pull requests to update these
examples would be welcome. ;)



.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Display VisPy visualizations in a PyQt5 application.">

.. only:: html

 .. figure:: /gallery/scene/realtime_data/images/thumb/sphx_glr_ex01_embedded_vispy_thumb.png
     :alt: Embed VisPy into Qt

     :ref:`sphx_glr_gallery_scene_realtime_data_ex01_embedded_vispy.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/realtime_data/ex01_embedded_vispy

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Control a VisPy visualization with Qt-based (PyQt5) UI elements.">

.. only:: html

 .. figure:: /gallery/scene/realtime_data/images/thumb/sphx_glr_ex02_control_vispy_from_qt_thumb.png
     :alt: Control VisPy from Qt

     :ref:`sphx_glr_gallery_scene_realtime_data_ex02_control_vispy_from_qt.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/realtime_data/ex02_control_vispy_from_qt

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Update VisPy visualizations from a QTimer in the main GUI thread.">

.. only:: html

 .. figure:: /gallery/scene/realtime_data/images/thumb/sphx_glr_ex03a_data_sources_timer_thumb.gif
     :alt: Update data using timer-based events

     :ref:`sphx_glr_gallery_scene_realtime_data_ex03a_data_sources_timer.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/realtime_data/ex03a_data_sources_timer

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Update VisPy visualizations from a background QThread.">

.. only:: html

 .. figure:: /gallery/scene/realtime_data/images/thumb/sphx_glr_ex03b_data_sources_threaded_loop_thumb.gif
     :alt: Update data using a loop in a background thread

     :ref:`sphx_glr_gallery_scene_realtime_data_ex03b_data_sources_threaded_loop.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/realtime_data/ex03b_data_sources_threaded_loop
.. raw:: html

    <div class="sphx-glr-clear"></div>



.. only :: html

 .. container:: sphx-glr-footer
    :class: sphx-glr-footer-gallery


  .. container:: sphx-glr-download sphx-glr-download-python

    :download:`Download all examples in Python source code: scene_python.zip </gallery/scene/scene_python.zip>`



  .. container:: sphx-glr-download sphx-glr-download-jupyter

    :download:`Download all examples in Jupyter notebooks: scene_jupyter.zip </gallery/scene/scene_jupyter.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
