.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_gallery/feature_demo/line_performance.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_feature_demo_line_performance.py: Line Drawing Performance ======================== Display a line depicting a noisy signal consisting of a lot of points. .. GENERATED FROM PYTHON SOURCE LINES 7-36 .. image-sg:: /_gallery/feature_demo/images/sphx_glr_line_performance_001.webp :alt: line performance :srcset: /_gallery/feature_demo/images/sphx_glr_line_performance_001.webp :class: sphx-glr-single-img .. code-block:: Python import numpy as np from rendercanvas.auto import RenderCanvas, loop import pygfx as gfx canvas = RenderCanvas() renderer = gfx.WgpuRenderer(canvas) scene = gfx.Scene() x = np.linspace(0, 100, 10_000, dtype=np.float32) y = np.sin(x) * 30 + np.random.normal(0, 5, len(x)).astype(np.float32) positions = np.column_stack([x, y, np.zeros_like(x)]) line = gfx.Line( gfx.Geometry(positions=positions), gfx.LineMaterial(thickness=2.0, color=(0.0, 0.7, 0.3, 0.1)), ) scene.add(line) camera = gfx.OrthographicCamera(110, 110) camera.local.position = (50, 0, 0) if __name__ == "__main__": canvas.request_draw(lambda: renderer.render(scene, camera)) loop.run() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.359 seconds) .. _sphx_glr_download__gallery_feature_demo_line_performance.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: line_performance.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: line_performance.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: line_performance.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_ .. only:: html Interactive example ------------------- Try this example in your browser using Pyodide. Might not work with all examples and all devices. Check the output and your browser's console for details. .. raw:: html