.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_gallery/validation/validate_points_size.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_validation_validate_points_size.py: Points with different sizes =========================== * On the left are points with increasing size, without aa, they don't get smaller than one physical pixel. * On the right are poonts with increasing size, with aa, really small points diminish with alpha. * Note that due to the set pixel_ratio, a thickness of 2 is 1 physical pixel. * The bottom row demonstrates per-vertex sizing. .. GENERATED FROM PYTHON SOURCE LINES 10-50 .. image-sg:: /_gallery/validation/images/sphx_glr_validate_points_size_001.webp :alt: validate points size :srcset: /_gallery/validation/images/sphx_glr_validate_points_size_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(size=(800, 600)) renderer = gfx.WgpuRenderer(canvas, pixel_ratio=0.5, pixel_filter=False) x = np.linspace(0, 4 * np.pi, 20) y = np.sin(x) positions = np.array([x, y, np.zeros_like(x)], np.float32).T.copy() geometry = gfx.Geometry(positions=positions, sizes=(10 - 4 * (positions[:, 1] + 1))) scene = gfx.Scene() for aa in [False, True]: y = 4 for size in [0.125, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0, 16, 0]: line = gfx.Points( geometry, gfx.PointsMaterial(size=size, color=(1.0, 1.0, 1.0), aa=aa), ) y += 2 line.local.y = -y line.local.x = [-8, 8][aa] scene.add(line) if size == 0: line.material.size_mode = "vertex" camera = gfx.OrthographicCamera() camera.show_object(scene, scale=0.7) canvas.request_draw(lambda: renderer.render(scene, camera)) if __name__ == "__main__": print(__doc__) loop.run() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.239 seconds) .. _sphx_glr_download__gallery_validation_validate_points_size.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: validate_points_size.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: validate_points_size.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: validate_points_size.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