:orphan:

Scene
=====

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

.. raw:: html

.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_background_borders_thumb.png
    :alt:

  :doc:`/gallery/scene/background_borders`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Demonstration of borders and background colors</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_colorbar_widget_thumb.png
    :alt:

  :doc:`/gallery/scene/colorbar_widget`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Display a ColorBar</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_colored_line_thumb.gif
    :alt:

  :doc:`/gallery/scene/colored_line`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Changing Line Colors</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_console_thumb.png
    :alt:

  :doc:`/gallery/scene/console`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Vispy Console</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_graph_thumb.gif
    :alt:

  :doc:`/gallery/scene/graph`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Visualize NetworkX Graph</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_infinite_line_thumb.png
    :alt:

  :doc:`/gallery/scene/infinite_line`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Draw an InfiniteLine</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Compare instanced and GL_POINTS rendering methods for Markers visual.">

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_instanced_markers_thumb.png
    :alt:

  :doc:`/gallery/scene/instanced_markers`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Markers with Instanced Rendering</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_instanced_quad_visual_thumb.png
    :alt:

  :doc:`/gallery/scene/instanced_quad_visual`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Custom Visual for instanced rendering of a colored quad</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_isocurve_thumb.png
    :alt:

  :doc:`/gallery/scene/isocurve`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Display an Isocurve</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_isocurve_for_trisurface_thumb.png
    :alt:

  :doc:`/gallery/scene/isocurve_for_trisurface`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Isocurve for Triangular Mesh</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_isocurve_for_trisurface_qt_thumb.png
    :alt:

  :doc:`/gallery/scene/isocurve_for_trisurface_qt`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Isocurve for Triangular Mesh with Qt Interface</div>
    </div>


.. 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

  .. image:: /gallery/scene/images/thumb/sphx_glr_isocurve_updates_thumb.gif
    :alt:

  :doc:`/gallery/scene/isocurve_updates`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Update Image and Isocurve Visuals</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_isosurface_thumb.png
    :alt:

  :doc:`/gallery/scene/isosurface`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Isosurface Visual</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_lasso_thumb.png
    :alt:

  :doc:`/gallery/scene/lasso`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Vispy Lasso</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_line_thumb.gif
    :alt:

  :doc:`/gallery/scene/line`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Draw a Line</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_line_update_thumb.gif
    :alt:

  :doc:`/gallery/scene/line_update`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Animated Line Visual</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_linear_region_thumb.png
    :alt:

  :doc:`/gallery/scene/linear_region`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Draw an LinearRegion</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_magnify_thumb.png
    :alt:

  :doc:`/gallery/scene/magnify`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Zoom in using MagnifyCamera</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_marker_spheres_thumb.png
    :alt:

  :doc:`/gallery/scene/marker_spheres`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Spheres and Sticks</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_nested_viewbox_thumb.png
    :alt:

  :doc:`/gallery/scene/nested_viewbox`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Nested Viewboxes</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Demonstrates use of visual.Markers to create a point cloud with a standard turntable camera to fly around with and a centered 3D Axis.">

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_point_cloud_thumb.png
    :alt:

  :doc:`/gallery/scene/point_cloud`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Create a Point Cloud</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_polygon_thumb.png
    :alt:

  :doc:`/gallery/scene/polygon`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Shape Visuals</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_save_animation_thumb.gif
    :alt:

  :doc:`/gallery/scene/save_animation`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Create and Save Animation</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_sensitivity_thumb.png
    :alt:

  :doc:`/gallery/scene/sensitivity`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Zoom Sensitivity</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Simple demonstration of drawing and editing shapes with the mouse This demo implements mouse picking on visuals and markers using the vispy scene and &quot;visual_at&quot; mechanism. Left mouse button on empty space creates new objects. Objects can be selected by clicking, and moved by dragging. Dragging control points changes the size of the object. Vispy takes care of coordinate transforms from screen to ViewBox - the demo works on different zoom levels. Lastly, additional objects are added to the view in a fixed position as &quot;buttons&quot; to select which type of object is being created. Selecting the arrow symbol will switch into select/pan mode where the left drag moves the workplane or moves objects/controlpoints.">

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_shape_draw_thumb.png
    :alt:

  :doc:`/gallery/scene/shape_draw`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Draw and Edit Shapes with Mouse</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_sphere_thumb.png
    :alt:

  :doc:`/gallery/scene/sphere`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Draw a Sphere</div>
    </div>


.. 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 independent of scaling of viewbox and canvas.">

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_text_thumb.png
    :alt:

  :doc:`/gallery/scene/text`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Text in a Scene and ViewBox</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_turntable_box_thumb.png
    :alt:

  :doc:`/gallery/scene/turntable_box`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Display a Cube</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/images/thumb/sphx_glr_viewbox_thumb.png
    :alt:

  :doc:`/gallery/scene/viewbox`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">ViewBox with Clipping Methods</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/scene/background_borders
   /gallery/scene/colorbar_widget
   /gallery/scene/colored_line
   /gallery/scene/console
   /gallery/scene/graph
   /gallery/scene/infinite_line
   /gallery/scene/instanced_markers
   /gallery/scene/instanced_quad_visual
   /gallery/scene/isocurve
   /gallery/scene/isocurve_for_trisurface
   /gallery/scene/isocurve_for_trisurface_qt
   /gallery/scene/isocurve_updates
   /gallery/scene/isosurface
   /gallery/scene/lasso
   /gallery/scene/line
   /gallery/scene/line_update
   /gallery/scene/linear_region
   /gallery/scene/magnify
   /gallery/scene/marker_spheres
   /gallery/scene/nested_viewbox
   /gallery/scene/point_cloud
   /gallery/scene/polygon
   /gallery/scene/save_animation
   /gallery/scene/sensitivity
   /gallery/scene/shape_draw
   /gallery/scene/sphere
   /gallery/scene/text
   /gallery/scene/turntable_box
   /gallery/scene/viewbox

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

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

.. raw:: html

.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/grid_layout/images/thumb/sphx_glr_grid_thumb.png
    :alt:

  :doc:`/gallery/scene/grid_layout/grid`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Multiple ViewBoxes on a Grid</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/grid_layout/images/thumb/sphx_glr_grid_basic_thumb.png
    :alt:

  :doc:`/gallery/scene/grid_layout/grid_basic`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Simple use of a grid layout</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/grid_layout/images/thumb/sphx_glr_grid_holed_thumb.png
    :alt:

  :doc:`/gallery/scene/grid_layout/grid_holed`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">More complex grid layout</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/grid_layout/images/thumb/sphx_glr_grid_large_thumb.png
    :alt:

  :doc:`/gallery/scene/grid_layout/grid_large`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Multiple Line Views on a Grid</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/grid_layout/images/thumb/sphx_glr_grid_uneven_col_thumb.png
    :alt:

  :doc:`/gallery/scene/grid_layout/grid_uneven_col`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Another Grid Layout</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/grid_layout/images/thumb/sphx_glr_grid_x_y_viewbox_thumb.png
    :alt:

  :doc:`/gallery/scene/grid_layout/grid_x_y_viewbox`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Plot-like Grid Layout</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>

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

.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/realtime_data/images/thumb/sphx_glr_ex01_embedded_vispy_thumb.png
    :alt:

  :doc:`/gallery/scene/realtime_data/ex01_embedded_vispy`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Embed VisPy into Qt</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/realtime_data/images/thumb/sphx_glr_ex02_control_vispy_from_qt_thumb.png
    :alt:

  :doc:`/gallery/scene/realtime_data/ex02_control_vispy_from_qt`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Control VisPy from Qt</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/realtime_data/images/thumb/sphx_glr_ex03a_data_sources_timer_thumb.gif
    :alt:

  :doc:`/gallery/scene/realtime_data/ex03a_data_sources_timer`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Update data using timer-based events</div>
    </div>


.. raw:: html

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

.. only:: html

  .. image:: /gallery/scene/realtime_data/images/thumb/sphx_glr_ex03b_data_sources_threaded_loop_thumb.gif
    :alt:

  :doc:`/gallery/scene/realtime_data/ex03b_data_sources_threaded_loop`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Update data using a loop in a background thread</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


.. toctree::
   :hidden:
   :includehidden:


   /gallery/scene/grid_layout/index.rst
   /gallery/scene/realtime_data/index.rst


.. only:: html

  .. container:: sphx-glr-footer 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>`_
