.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/scene/marker_spheres.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_marker_spheres.py: Spheres and Sticks ================== Draw spherical Markers with Tube meshes connecting them. .. GENERATED FROM PYTHON SOURCE LINES 13-57 .. image-sg:: /gallery/scene/images/sphx_glr_marker_spheres_001.png :alt: marker spheres :srcset: /gallery/scene/images/sphx_glr_marker_spheres_001.png :class: sphx-glr-single-img .. code-block:: Python import numpy as np from vispy import app, scene # Create canvas and view canvas = scene.SceneCanvas(keys='interactive', size=(600, 600), show=True) view = canvas.central_widget.add_view() view.camera = scene.cameras.ArcballCamera(fov=0) view.camera.scale_factor = 500 # Prepare data np.random.seed(57983) data = np.random.normal(size=(40, 3), loc=0, scale=100) size = np.random.rand(40) * 100 colors = np.random.rand(40, 3) data = np.concatenate([data, [[0, 0, 0]]], axis=0) size = np.concatenate([size, [100]], axis=0) colors = np.concatenate([colors, [[1, 0, 0]]], axis=0) # Create and show visual vis = scene.visuals.Markers( pos=data, size=100, antialias=0, face_color=colors, edge_color='white', edge_width=0, scaling=True, spherical=True, ) vis.parent = view.scene lines = np.array([[data[i], data[-1]] for i in range(len(data) - 1)]) line_vis = [] for line in lines: vis2 = scene.visuals.Tube(line, radius=5) vis2.parent = view.scene line_vis.append(vis2) if __name__ == "__main__": app.run() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.611 seconds) .. _sphx_glr_download_gallery_scene_marker_spheres.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: marker_spheres.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: marker_spheres.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_