
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/scene/colorbar_widget.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_colorbar_widget.py>`
        to download the full example code.

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

.. _sphx_glr_gallery_scene_colorbar_widget.py:


Display a ColorBar
==================

Simple use of SceneCanvas and ColorBarWidget to display a ColorBar

.. GENERATED FROM PYTHON SOURCE LINES 13-32



.. image-sg:: /gallery/scene/images/sphx_glr_colorbar_widget_001.png
   :alt: colorbar widget
   :srcset: /gallery/scene/images/sphx_glr_colorbar_widget_001.png
   :class: sphx-glr-single-img





.. code-block:: Python

    import sys
    from vispy import scene
    from vispy import app

    canvas = scene.SceneCanvas(keys='interactive')
    canvas.size = 800, 600
    canvas.show()
    grid = canvas.central_widget.add_grid(margin=10)

    cbar_widget = scene.ColorBarWidget(label="ColorBarWidget", clim=(0, 99),
                                       cmap="cool", orientation="right",
                                       border_width=1)
    grid.add_widget(cbar_widget)

    cbar_widget.border_color = "#212121"
    grid.bgcolor = "#ffffff"

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


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

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


.. _sphx_glr_download_gallery_scene_colorbar_widget.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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