Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion fastplotlib/graphics/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ def __init__(
self._vmin = ImageVmin(vmin)
self._vmax = ImageVmax(vmax)

self._cmap = ImageCmap(cmap)
# set cmap to None for RGB images
if self._data.value.ndim == 3:
self._cmap = None
else:
self._cmap = ImageCmap(cmap)

self._interpolation = ImageInterpolation(interpolation)
self._cmap_interpolation = ImageCmapInterpolation(cmap_interpolation)
Expand Down Expand Up @@ -189,10 +193,14 @@ def data(self, data):
@property
def cmap(self) -> str:
"""colormap name"""
if self.data.value.ndim == 3:
raise AttributeError("RGB images do not have a colormap property")
return self._cmap.value

@cmap.setter
def cmap(self, name: str):
if self.data.value.ndim == 3:
raise AttributeError("RGB images do not have a colormap property")
self._cmap.set_value(self, name)

@property
Expand Down