
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/scene/grid_layout/grid_x_y_viewbox.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_gallery_scene_grid_layout_grid_x_y_viewbox.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_scene_grid_layout_grid_x_y_viewbox.py:


Plot-like Grid Layout
=====================

+----+-------------+
|    |             |
| y  |   viewbox   |
|    |             |
+----+-------------+
| sp |     x       |
+----+-------------+

.. GENERATED FROM PYTHON SOURCE LINES 20-50



.. image-sg:: /gallery/scene/grid_layout/images/sphx_glr_grid_x_y_viewbox_001.png
   :alt: grid x y viewbox
   :srcset: /gallery/scene/grid_layout/images/sphx_glr_grid_x_y_viewbox_001.png
   :class: sphx-glr-single-img





.. code-block:: Python


    import sys

    from vispy import scene, app

    canvas = scene.SceneCanvas(keys='interactive')
    canvas.size = 600, 600
    canvas.show()

    grid = canvas.central_widget.add_grid()

    widget_y_axis = grid.add_widget(row=0, col=0)
    widget_y_axis.bgcolor = "#999999"

    widget_viewbox = grid.add_widget(row=0, col=1)
    widget_viewbox.bgcolor = "#dd0000"

    widget_spacer_bottom = grid.add_widget(row=1, col=0)
    widget_spacer_bottom.bgcolor = "#efefef"

    widget_x_axis = grid.add_widget(row=1, col=1)
    widget_x_axis.bgcolor = "#0000dd"

    widget_y_axis.width_min = 50
    widget_y_axis.width_max = 50
    widget_x_axis.height_min = 50
    widget_x_axis.height_max = 50

    if __name__ == '__main__' and sys.flags.interactive == 0:
        app.run()


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 0.458 seconds)


.. _sphx_glr_download_gallery_scene_grid_layout_grid_x_y_viewbox.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

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

      :download:`Download Jupyter notebook: grid_x_y_viewbox.ipynb <grid_x_y_viewbox.ipynb>`

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

      :download:`Download Python source code: grid_x_y_viewbox.py <grid_x_y_viewbox.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: grid_x_y_viewbox.zip <grid_x_y_viewbox.zip>`


.. only:: html

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

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