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

.. only:: html

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

        Click :ref:`here <sphx_glr_download_gallery_scene_axes_plot.py>`
        to download the full example code

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

.. _sphx_glr_gallery_scene_axes_plot.py:


Simple Line with Axis 
=====================

.. GENERATED FROM PYTHON SOURCE LINES 12-61



.. image-sg:: /gallery/scene/images/sphx_glr_axes_plot_001.png
   :alt: axes plot
   :srcset: /gallery/scene/images/sphx_glr_axes_plot_001.png
   :class: sphx-glr-single-img





.. code-block:: default

    import sys
    import numpy as np

    from vispy import scene, app

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

    title = scene.Label("Plot Title", color='white')
    title.height_max = 40
    grid.add_widget(title, row=0, col=0, col_span=2)

    yaxis = scene.AxisWidget(orientation='left',
                             axis_label='Y Axis',
                             axis_font_size=12,
                             axis_label_margin=50,
                             tick_label_margin=5)
    yaxis.width_max = 80
    grid.add_widget(yaxis, row=1, col=0)

    xaxis = scene.AxisWidget(orientation='bottom',
                             axis_label='X Axis',
                             axis_font_size=12,
                             axis_label_margin=50,
                             tick_label_margin=5)

    xaxis.height_max = 80
    grid.add_widget(xaxis, row=2, col=1)

    right_padding = grid.add_widget(row=1, col=2, row_span=1)
    right_padding.width_max = 50

    view = grid.add_view(row=1, col=1, border_color='white')
    data = np.random.normal(size=(1000, 2))
    data[0] = -10, -10
    data[1] = 10, -10
    data[2] = 10, 10
    data[3] = -10, 10
    data[4] = -10, -10
    plot = scene.Line(data, parent=view.scene)
    view.camera = 'panzoom'

    xaxis.link_view(view)
    yaxis.link_view(view)


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


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

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


.. _sphx_glr_download_gallery_scene_axes_plot.py:


.. only :: html

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



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

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



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

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


.. only:: html

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

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