From cd539037cbeb5780dbac56b622da216cc9f14f5f Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 2 Oct 2025 12:03:30 +0200 Subject: [PATCH 1/9] Only auto-offset images, and push back instead of forward --- fastplotlib/graphics/_axes.py | 16 +++++++++---- fastplotlib/graphics/line.py | 12 +++++----- fastplotlib/graphics/scatter.py | 5 +--- fastplotlib/layouts/_plot_area.py | 39 +++++++++++++++++++++++-------- fastplotlib/utils/enums.py | 7 +++--- 5 files changed, 52 insertions(+), 27 deletions(-) diff --git a/fastplotlib/graphics/_axes.py b/fastplotlib/graphics/_axes.py index 8063e2819..6847c2770 100644 --- a/fastplotlib/graphics/_axes.py +++ b/fastplotlib/graphics/_axes.py @@ -183,14 +183,22 @@ def __init__( } # create ruler for each dim - self._x = pygfx.Ruler(alpha_mode="solid", **x_kwargs) - self._y = pygfx.Ruler(alpha_mode="solid", **y_kwargs) - self._z = pygfx.Ruler(alpha_mode="solid", **z_kwargs) + self._x = pygfx.Ruler( + alpha_mode="solid", render_queue=RenderQueue.axes, **x_kwargs + ) + self._y = pygfx.Ruler( + alpha_mode="solid", render_queue=RenderQueue.axes, **y_kwargs + ) + self._z = pygfx.Ruler( + alpha_mode="solid", render_queue=RenderQueue.axes, **z_kwargs + ) # We render the lines and ticks as solid, but enable aa for text for prettier glyphs for ruler in self._x, self._y, self._z: + ruler.line.material.depth_compare = "<=" + ruler.points.material.depth_compare = "<=" + ruler.text.material.depth_compare = "<=" ruler.text.material.alpha_mode = "auto" - ruler.text.material.render_queue = RenderQueue.auto + 50 ruler.text.material.aa = True self._offset = offset diff --git a/fastplotlib/graphics/line.py b/fastplotlib/graphics/line.py index bd3bbc397..95dced402 100644 --- a/fastplotlib/graphics/line.py +++ b/fastplotlib/graphics/line.py @@ -95,29 +95,29 @@ def __init__( self._thickness = Thickness(thickness) if thickness < 1.1: - MaterialCls = pygfx.LineThinMaterial + aa = True else: - MaterialCls = pygfx.LineMaterial - - aa = kwargs.get("alpha_mode", "auto") in ("blend", "weighted_blend") + aa = kwargs.get("alpha_mode", "auto") in ("blend", "weighted_blend") if uniform_color: geometry = pygfx.Geometry(positions=self._data.buffer) - material = MaterialCls( + material = pygfx.LineMaterial( aa=aa, thickness=self.thickness, color_mode="uniform", color=self.colors, pick_write=True, thickness_space=self.size_space, + depth_compare="<=", ) else: - material = MaterialCls( + material = pygfx.LineMaterial( aa=aa, thickness=self.thickness, color_mode="vertex", pick_write=True, thickness_space=self.size_space, + depth_compare="<=", ) geometry = pygfx.Geometry( positions=self._data.buffer, colors=self._colors.buffer diff --git a/fastplotlib/graphics/scatter.py b/fastplotlib/graphics/scatter.py index 73095714b..6bff05fa5 100644 --- a/fastplotlib/graphics/scatter.py +++ b/fastplotlib/graphics/scatter.py @@ -97,10 +97,7 @@ def __init__( aa = kwargs.get("alpha_mode", "auto") in ("blend", "weighted_blend") geo_kwargs = {"positions": self._data.buffer} - material_kwargs = dict( - pick_write=True, - aa=aa, - ) + material_kwargs = dict(pick_write=True, aa=aa, depth_compare="<=") self._size_space = SizeSpace(size_space) if uniform_color: diff --git a/fastplotlib/layouts/_plot_area.py b/fastplotlib/layouts/_plot_area.py index feda52930..7b5c7952a 100644 --- a/fastplotlib/layouts/_plot_area.py +++ b/fastplotlib/layouts/_plot_area.py @@ -10,6 +10,7 @@ from ._utils import create_controller from ..graphics._base import Graphic +from ..graphics import ImageGraphic from ..graphics.selectors._base_selector import BaseSelector from ._graphic_methods_mixin import GraphicMethodsMixin from ..legends import Legend @@ -394,6 +395,29 @@ def remove_animation(self, func): if func in self._animate_funcs_post: self._animate_funcs_post.remove(func) + def _sort_images_by_depth(self): + """ + In general, we want to avoid setting the offset of a graphic, because the + z-dimension may actually mean something; we cannot know whether the user is + building a 3D scene or not. We could check whether the 3d dimension of line/point data + is all zeros, but maybe this is intended, and *other* graphics in the same scene + may be actually 3D. We could check camera.fov being zero, but maybe the user + switches to a 3D camera later, or uses a 3D orthographic camera. + + The one exception, kindof, is images, which are inherently 2D, and for which + layering helps a lot to get things rendered correctly. So we basically layer the + images, in the order that they were added, pushing older images backwards (away + from the camera). + """ + count = 0 + for graphic in self._graphics: + if isinstance(graphic, ImageGraphic): + count += 1 + auto_depth = -count + user_changed_depth = graphic.offset[2] % 1 > 0.0 # i.e. is not integer + if not user_changed_depth: + graphic.offset = (*graphic.offset[:-1], auto_depth) + def add_graphic(self, graphic: Graphic, center: bool = True): """ Add a Graphic to the scene @@ -416,10 +440,8 @@ def add_graphic(self, graphic: Graphic, center: bool = True): self._add_or_insert_graphic(graphic=graphic, center=center, action="add") - if self.camera.fov == 0: - # for orthographic positions stack objects along the z-axis - # for perspective projections we assume the user wants full 3D control - graphic.offset = (*graphic.offset[:-1], len(self)) + if isinstance(graphic, ImageGraphic): + self._sort_images_by_depth() def insert_graphic( self, @@ -458,17 +480,14 @@ def insert_graphic( graphic=graphic, center=center, action="insert", index=index ) - if self.camera.fov == 0: - # for orthographic positions stack objects along the z-axis - # for perspective projections we assume the user wants full 3D control - if auto_offset: - graphic.offset = (*graphic.offset[:-1], index) + if isinstance(graphic, ImageGraphic): + self._sort_images_by_depth() def _add_or_insert_graphic( self, graphic: Graphic, center: bool = True, - action: str = Literal["insert", "add"], + action: Literal["insert", "add"] = "add", index: int = 0, ): """Private method to handle inserting or adding a graphic to a PlotArea.""" diff --git a/fastplotlib/utils/enums.py b/fastplotlib/utils/enums.py index 5de3b2e0a..3901b082c 100644 --- a/fastplotlib/utils/enums.py +++ b/fastplotlib/utils/enums.py @@ -9,6 +9,7 @@ class RenderQueue(IntEnum): auto = 2600 transparent = 3000 overlay = 4000 - # For selectors we use a render_queue of 3500, which is at the end of what is considered the group of transparent objects. - # So it's rendered later than the normal scene (2000 - 3000), but before overlays like legends and tooltips. - selector = 3500 + # For axes and selectors we use a higher render_queue, so they get rendered later than + # the graphics. Axes (rulers) have depth_compare '<=' and selectors don't compare depth. + axes = 3400 # still in 'object' group + selector = 3600 # considered in 'overlay' group From 1bfc19fd3604a55e887ab2ea2d7aabecdfb947d6 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 2 Oct 2025 12:13:55 +0200 Subject: [PATCH 2/9] remove unnecessary use of offset --- examples/gridplot/gridplot.py | 21 ++++++++++++++++----- fastplotlib/graphics/image.py | 12 ------------ fastplotlib/graphics/line.py | 6 ------ fastplotlib/graphics/line_collection.py | 6 ------ fastplotlib/legends/legend.py | 1 - 5 files changed, 16 insertions(+), 30 deletions(-) diff --git a/examples/gridplot/gridplot.py b/examples/gridplot/gridplot.py index 5edd6a845..fb82441c0 100644 --- a/examples/gridplot/gridplot.py +++ b/examples/gridplot/gridplot.py @@ -10,22 +10,33 @@ import fastplotlib as fpl import imageio.v3 as iio +import numpy as np figure = fpl.Figure(shape=(2, 2), size=(700, 560)) -im = iio.imread("imageio:clock.png") -im2 = iio.imread("imageio:astronaut.png") +im1 = iio.imread("imageio:clock.png") +im2 = iio.imread("imageio:astronaut.png")[:500,:300] im3 = iio.imread("imageio:coffee.png") im4 = iio.imread("imageio:hubble_deep_field.png") -figure[0, 0].add_image(data=im) -figure[0, 1].add_image(data=im2) +xs = np.linspace(-10, 10, 100) +a = 0.5 +ys = np.sinc(xs) * 3 + 8 +sinc_data = np.column_stack([xs, ys]) + +i1=figure[0, 0].add_image(data=im1) +i2=figure[0, 0].add_image(data=im2) figure[1, 0].add_image(data=im3) -figure[1, 1].add_image(data=im4) +x = figure[1, 1].add_line(sinc_data, thickness=12, cmap="autumn") +y = figure[1, 1].add_line(sinc_data, thickness=2, cmap="jet") figure.show() +r = figure[0,1].scene.children[2].children[0] +i = figure[0,1].graphics[0].world_object.children[0] + + # NOTE: fpl.loop.run() should not be used for interactive sessions # See the "JupyterLab and IPython" section in the user guide if __name__ == "__main__": diff --git a/fastplotlib/graphics/image.py b/fastplotlib/graphics/image.py index 4a33d2c1d..1eaf54bb6 100644 --- a/fastplotlib/graphics/image.py +++ b/fastplotlib/graphics/image.py @@ -324,9 +324,6 @@ def add_linear_selector( self._plot_area.add_graphic(selector, center=False) - # place selector above this graphic - selector.offset = selector.offset + (0.0, 0.0, self.offset[-1] + 1) - return selector def add_linear_region_selector( @@ -402,9 +399,6 @@ def add_linear_region_selector( self._plot_area.add_graphic(selector, center=False) - # place above this graphic - selector.offset = selector.offset + (0.0, 0.0, self.offset[-1] + 1) - return selector def add_rectangle_selector( @@ -447,9 +441,6 @@ def add_rectangle_selector( self._plot_area.add_graphic(selector, center=False) - # place above this graphic - selector.offset = selector.offset + (0.0, 0.0, self.offset[-1] + 1) - return selector def add_polygon_selector( @@ -485,7 +476,4 @@ def add_polygon_selector( self._plot_area.add_graphic(selector, center=False) - # place above this graphic - selector.offset = selector.offset + (0.0, 0.0, self.offset[-1] + 1) - return selector diff --git a/fastplotlib/graphics/line.py b/fastplotlib/graphics/line.py index 95dced402..c18411362 100644 --- a/fastplotlib/graphics/line.py +++ b/fastplotlib/graphics/line.py @@ -179,9 +179,6 @@ def add_linear_selector( self._plot_area.add_graphic(selector, center=False) - # place selector above this graphic - selector.offset = selector.offset + (0.0, 0.0, self.offset[-1] + 1) - return selector def add_linear_region_selector( @@ -238,9 +235,6 @@ def add_linear_region_selector( self._plot_area.add_graphic(selector, center=False) - # place selector below this graphic - selector.offset = selector.offset + (0.0, 0.0, self.offset[-1] - 1) - # PlotArea manages this for garbage collection etc. just like all other Graphics # so we should only work with a proxy on the user-end return selector diff --git a/fastplotlib/graphics/line_collection.py b/fastplotlib/graphics/line_collection.py index 3d183593a..275cc1e47 100644 --- a/fastplotlib/graphics/line_collection.py +++ b/fastplotlib/graphics/line_collection.py @@ -378,9 +378,6 @@ def add_linear_selector( self._plot_area.add_graphic(selector, center=False) - # place selector above this graphic - selector.offset = selector.offset + (0.0, 0.0, self.offset[-1] + 1) - return selector def add_linear_region_selector( @@ -435,9 +432,6 @@ def add_linear_region_selector( self._plot_area.add_graphic(selector, center=False) - # place selector below this graphic - selector.offset = selector.offset + (0.0, 0.0, self.offset[-1] - 1) - # PlotArea manages this for garbage collection etc. just like all other Graphics # so we should only work with a proxy on the user-end return selector diff --git a/fastplotlib/legends/legend.py b/fastplotlib/legends/legend.py index b24bcac58..e6b2a17d3 100644 --- a/fastplotlib/legends/legend.py +++ b/fastplotlib/legends/legend.py @@ -112,7 +112,6 @@ def __init__( self._label_world_object.world.x = position[0] + 10 self.world_object.world.y = position[1] - self.world_object.world.z = 2 self.world_object.add_event_handler( partial(self._highlight_graphic, graphic), "click" From d049e36a7eb8f4e251c59748693f4e77945dc62b Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 2 Oct 2025 12:35:16 +0200 Subject: [PATCH 3/9] restore thin line --- fastplotlib/graphics/line.py | 9 ++++++--- fastplotlib/legends/legend.py | 4 +--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fastplotlib/graphics/line.py b/fastplotlib/graphics/line.py index c18411362..f2d862067 100644 --- a/fastplotlib/graphics/line.py +++ b/fastplotlib/graphics/line.py @@ -95,13 +95,16 @@ def __init__( self._thickness = Thickness(thickness) if thickness < 1.1: + MaterialCls = pygfx.LineThinMaterial aa = True else: - aa = kwargs.get("alpha_mode", "auto") in ("blend", "weighted_blend") + MaterialCls = pygfx.LineMaterial + + aa = kwargs.get("alpha_mode", "auto") in ("blend", "weighted_blend") if uniform_color: geometry = pygfx.Geometry(positions=self._data.buffer) - material = pygfx.LineMaterial( + material = MaterialCls( aa=aa, thickness=self.thickness, color_mode="uniform", @@ -111,7 +114,7 @@ def __init__( depth_compare="<=", ) else: - material = pygfx.LineMaterial( + material = MaterialCls( aa=aa, thickness=self.thickness, color_mode="vertex", diff --git a/fastplotlib/legends/legend.py b/fastplotlib/legends/legend.py index e6b2a17d3..9da836fd7 100644 --- a/fastplotlib/legends/legend.py +++ b/fastplotlib/legends/legend.py @@ -71,11 +71,9 @@ def __init__( # construct Line WorldObject data = np.array([[0, 0, 0], [3, 0, 0]], dtype=np.float32) - material = pygfx.LineMaterial - self._line_world_object = pygfx.Line( geometry=pygfx.Geometry(positions=data), - material=material( + material=pygfx.LineMaterial( alpha_mode="blend", render_queue=RenderQueue.overlay, thickness=8, From c9541b370055e6379fc4a112f5dd5bcb7a01bbe1 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 2 Oct 2025 15:54:04 +0200 Subject: [PATCH 4/9] restore gridplot --- examples/gridplot/gridplot.py | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/examples/gridplot/gridplot.py b/examples/gridplot/gridplot.py index fb82441c0..1aa8c8083 100644 --- a/examples/gridplot/gridplot.py +++ b/examples/gridplot/gridplot.py @@ -10,35 +10,24 @@ import fastplotlib as fpl import imageio.v3 as iio -import numpy as np figure = fpl.Figure(shape=(2, 2), size=(700, 560)) -im1 = iio.imread("imageio:clock.png") -im2 = iio.imread("imageio:astronaut.png")[:500,:300] +im = iio.imread("imageio:clock.png") +im2 = iio.imread("imageio:astronaut.png") im3 = iio.imread("imageio:coffee.png") im4 = iio.imread("imageio:hubble_deep_field.png") -xs = np.linspace(-10, 10, 100) -a = 0.5 -ys = np.sinc(xs) * 3 + 8 -sinc_data = np.column_stack([xs, ys]) - -i1=figure[0, 0].add_image(data=im1) -i2=figure[0, 0].add_image(data=im2) +figure[0, 0].add_image(data=im) +figure[0, 1].add_image(data=im2) figure[1, 0].add_image(data=im3) -x = figure[1, 1].add_line(sinc_data, thickness=12, cmap="autumn") -y = figure[1, 1].add_line(sinc_data, thickness=2, cmap="jet") +figure[1, 1].add_image(data=im4) figure.show() -r = figure[0,1].scene.children[2].children[0] -i = figure[0,1].graphics[0].world_object.children[0] - - # NOTE: fpl.loop.run() should not be used for interactive sessions # See the "JupyterLab and IPython" section in the user guide if __name__ == "__main__": print(__doc__) - fpl.loop.run() + fpl.loop.run() \ No newline at end of file From fe924c3e91c0e45b625fbd1ac833f0aa42ee338d Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 2 Oct 2025 16:00:31 +0200 Subject: [PATCH 5/9] new screenshots --- examples/screenshots/line_collection_slicing.png | 4 ++-- examples/screenshots/scatter_colorslice_iris.png | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/screenshots/line_collection_slicing.png b/examples/screenshots/line_collection_slicing.png index 428e6c33d..9a163bdd4 100644 --- a/examples/screenshots/line_collection_slicing.png +++ b/examples/screenshots/line_collection_slicing.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a88282f40fb1c02dfe7921793128e9b7abe1bbb85de0e12abc20cb23d3ecc720 -size 73949 +oid sha256:3283a717635f0e39c3da66e705dc988db4054d9210761265bde2f48f8e8c4fce +size 74585 diff --git a/examples/screenshots/scatter_colorslice_iris.png b/examples/screenshots/scatter_colorslice_iris.png index d7271ce71..5c5d6d4be 100644 --- a/examples/screenshots/scatter_colorslice_iris.png +++ b/examples/screenshots/scatter_colorslice_iris.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d4f95d45d58779e7afe2b6898621c3e8d46c2dadc04406ed9ffa09c8c84c19b3 -size 25582 +oid sha256:9549c19c4d9ad6804036a4b1018ae438793cb350228d7f00fc0e38f74cd058b9 +size 25893 From 23166b587b82492cac18ad5434c96b7f18e93943 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Fri, 3 Oct 2025 10:02:20 +0200 Subject: [PATCH 6/9] add examples --- examples/screenshots/line_collection_slicing.png | 4 ++-- examples/screenshots/nb-lines-data.png | 3 +++ examples/screenshots/nb-lines-underlay.png | 3 +++ examples/screenshots/scatter_colorslice_iris.png | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 examples/screenshots/nb-lines-data.png create mode 100644 examples/screenshots/nb-lines-underlay.png diff --git a/examples/screenshots/line_collection_slicing.png b/examples/screenshots/line_collection_slicing.png index 9a163bdd4..428e6c33d 100644 --- a/examples/screenshots/line_collection_slicing.png +++ b/examples/screenshots/line_collection_slicing.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3283a717635f0e39c3da66e705dc988db4054d9210761265bde2f48f8e8c4fce -size 74585 +oid sha256:a88282f40fb1c02dfe7921793128e9b7abe1bbb85de0e12abc20cb23d3ecc720 +size 73949 diff --git a/examples/screenshots/nb-lines-data.png b/examples/screenshots/nb-lines-data.png new file mode 100644 index 000000000..44f6e486b --- /dev/null +++ b/examples/screenshots/nb-lines-data.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c602844bcbd32d94838d5c9c74c4620162bd65bd87bbabe9c60b417fdefdc5ee +size 37158 diff --git a/examples/screenshots/nb-lines-underlay.png b/examples/screenshots/nb-lines-underlay.png new file mode 100644 index 000000000..4ad000048 --- /dev/null +++ b/examples/screenshots/nb-lines-underlay.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5895cfb7c24749b54acb26c4903ebd4508b65ef436a6e8de3ac7f40ac03d76f7 +size 50003 diff --git a/examples/screenshots/scatter_colorslice_iris.png b/examples/screenshots/scatter_colorslice_iris.png index 5c5d6d4be..d7271ce71 100644 --- a/examples/screenshots/scatter_colorslice_iris.png +++ b/examples/screenshots/scatter_colorslice_iris.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9549c19c4d9ad6804036a4b1018ae438793cb350228d7f00fc0e38f74cd058b9 -size 25893 +oid sha256:d4f95d45d58779e7afe2b6898621c3e8d46c2dadc04406ed9ffa09c8c84c19b3 +size 25582 From 8f8a292d6df378120dba701865294b04da7b6092 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Fri, 3 Oct 2025 10:22:30 +0200 Subject: [PATCH 7/9] update examples again? --- examples/screenshots/line_collection_slicing.png | 4 ++-- examples/screenshots/scatter_colorslice_iris.png | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/screenshots/line_collection_slicing.png b/examples/screenshots/line_collection_slicing.png index 428e6c33d..9a163bdd4 100644 --- a/examples/screenshots/line_collection_slicing.png +++ b/examples/screenshots/line_collection_slicing.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a88282f40fb1c02dfe7921793128e9b7abe1bbb85de0e12abc20cb23d3ecc720 -size 73949 +oid sha256:3283a717635f0e39c3da66e705dc988db4054d9210761265bde2f48f8e8c4fce +size 74585 diff --git a/examples/screenshots/scatter_colorslice_iris.png b/examples/screenshots/scatter_colorslice_iris.png index d7271ce71..5c5d6d4be 100644 --- a/examples/screenshots/scatter_colorslice_iris.png +++ b/examples/screenshots/scatter_colorslice_iris.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d4f95d45d58779e7afe2b6898621c3e8d46c2dadc04406ed9ffa09c8c84c19b3 -size 25582 +oid sha256:9549c19c4d9ad6804036a4b1018ae438793cb350228d7f00fc0e38f74cd058b9 +size 25893 From ef7d6ce79825cd143f210be9693b3d02fd55902d Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 9 Oct 2025 09:08:39 +0200 Subject: [PATCH 8/9] remove screenshots added in wrong plance --- examples/screenshots/nb-lines-data.png | 3 --- examples/screenshots/nb-lines-underlay.png | 3 --- 2 files changed, 6 deletions(-) delete mode 100644 examples/screenshots/nb-lines-data.png delete mode 100644 examples/screenshots/nb-lines-underlay.png diff --git a/examples/screenshots/nb-lines-data.png b/examples/screenshots/nb-lines-data.png deleted file mode 100644 index 44f6e486b..000000000 --- a/examples/screenshots/nb-lines-data.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c602844bcbd32d94838d5c9c74c4620162bd65bd87bbabe9c60b417fdefdc5ee -size 37158 diff --git a/examples/screenshots/nb-lines-underlay.png b/examples/screenshots/nb-lines-underlay.png deleted file mode 100644 index 4ad000048..000000000 --- a/examples/screenshots/nb-lines-underlay.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5895cfb7c24749b54acb26c4903ebd4508b65ef436a6e8de3ac7f40ac03d76f7 -size 50003 From 6f13019b461bac99a866723887a262234fd8eb41 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Thu, 9 Oct 2025 09:18:13 +0200 Subject: [PATCH 9/9] better blending for iris scatter example --- examples/scatter/scatter_colorslice_iris.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/scatter/scatter_colorslice_iris.py b/examples/scatter/scatter_colorslice_iris.py index 425a2f1ff..d9dc3053f 100644 --- a/examples/scatter/scatter_colorslice_iris.py +++ b/examples/scatter/scatter_colorslice_iris.py @@ -23,7 +23,8 @@ data=data[:, :-1], sizes=6, alpha=0.7, - colors=colors # use colors from the list of strings + alpha_mode="weighted_blend", # blend overlapping dots + colors=colors, # use colors from the list of strings ) figure.show()