Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 61d7962

Browse files
authored
fix comment, fix doc example readme file (#769)
* fix comment, fix doc example readme file * update get_cmap_texture to return pygfx.Texture since cmap lib changed
1 parent 20c9421 commit 61d7962

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

examples/window_layouts/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
WindowLayout Examples
2-
=====================
1+
Window Layout Examples
2+
======================

fastplotlib/layouts/_plot_area.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,10 @@ def __init__(
8787
self._animate_funcs_pre: list[callable] = list()
8888
self._animate_funcs_post: list[callable] = list()
8989

90-
# list of hex id strings for all graphics managed by this PlotArea
91-
# the real Graphic instances are managed by REFERENCES
90+
# list of all graphics managed by this PlotArea
9291
self._graphics: list[Graphic] = list()
9392

9493
# selectors are in their own list so they can be excluded from scene bbox calculations
95-
# managed similar to GRAPHICS for garbage collection etc.
9694
self._selectors: list[BaseSelector] = list()
9795

9896
# legends, managed just like other graphics as explained above

fastplotlib/utils/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def make_colors(n_colors: int, cmap: str, alpha: float = 1.0) -> np.ndarray:
205205

206206

207207
def get_cmap_texture(name: str, alpha: float = 1.0) -> Texture:
208-
return cmap_lib.Colormap(name).to_pygfx()
208+
return Texture(get_cmap(name, alpha), dim=1)
209209

210210

211211
def make_colors_dict(labels: Sequence, cmap: str, **kwargs) -> OrderedDict:

tests/test_image_graphic.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from numpy import testing as npt
33
import imageio.v3 as iio
44

5+
import pygfx
6+
57
import fastplotlib as fpl
68
from fastplotlib.graphics._features import FeatureEvent
79
from fastplotlib.utils import make_colors
@@ -86,6 +88,10 @@ def test_gray():
8688
# the entire image should be in the single Texture buffer
8789
npt.assert_almost_equal(ig.data.buffer[0, 0].data, GRAY_IMAGE)
8890

91+
assert isinstance(ig._material, pygfx.ImageBasicMaterial)
92+
assert isinstance(ig._material.map, pygfx.TextureMap)
93+
assert isinstance(ig._material.map.texture, pygfx.Texture)
94+
8995
ig.cmap = "viridis"
9096
assert ig.cmap == "viridis"
9197
check_event(graphic=ig, feature="cmap", value="viridis")

0 commit comments

Comments
 (0)