.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/scene/sphere.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_scene_sphere.py: Draw a Sphere ============= This example demonstrates how to create a sphere. .. GENERATED FROM PYTHON SOURCE LINES 13-42 .. image-sg:: /gallery/scene/images/sphx_glr_sphere_001.png :alt: sphere :srcset: /gallery/scene/images/sphx_glr_sphere_001.png :class: sphx-glr-single-img .. code-block:: Python import sys from vispy import scene from vispy.visuals.transforms import STTransform canvas = scene.SceneCanvas(keys='interactive', bgcolor='white', size=(800, 600), show=True) view = canvas.central_widget.add_view() view.camera = 'arcball' sphere1 = scene.visuals.Sphere(radius=1, method='latitude', parent=view.scene, edge_color='black') sphere2 = scene.visuals.Sphere(radius=1, method='ico', parent=view.scene, edge_color='black') sphere3 = scene.visuals.Sphere(radius=1, rows=10, cols=10, depth=10, method='cube', parent=view.scene, edge_color='black') sphere1.transform = STTransform(translate=[-2.5, 0, 0]) sphere3.transform = STTransform(translate=[2.5, 0, 0]) view.camera.set_range(x=[-3, 3]) if __name__ == '__main__' and sys.flags.interactive == 0: canvas.app.run() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.539 seconds) .. _sphx_glr_download_gallery_scene_sphere.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: sphere.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: sphere.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: sphere.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_