File tree 1 file changed +28
-0
lines changed
Filter options
1 file changed +28
-0
lines changed
Original file line number Diff line number Diff line change @@ -113,6 +113,34 @@ def managed_graphics(self) -> List[ImageGraphic]:
113
113
iw_managed .append (subplot ["image_widget_managed" ])
114
114
return iw_managed
115
115
116
+ @property
117
+ def cmap (self ) -> List [str ]:
118
+ cmaps = list ()
119
+ for g in self .managed_graphics :
120
+ cmaps .append (g .cmap .name )
121
+
122
+ return cmaps
123
+
124
+ @cmap .setter
125
+ def cmap (self , names : Union [str , List [str ]]):
126
+ if isinstance (names , list ):
127
+ if not all ([isinstance (n , str ) for n in names ]):
128
+ raise TypeError (f"Must pass cmap name as a `str` of list of `str`, you have passed:\n { names } " )
129
+
130
+ if not len (names ) == len (self .managed_graphics ):
131
+ raise IndexError (
132
+ f"If passing a list of cmap names, the length of the list must be the same as the number of "
133
+ f"image widget subplots. You have passed: { len (names )} cmap names and have "
134
+ f"{ len (self .managed_graphics )} image widget subplots"
135
+ )
136
+
137
+ for name , g in zip (names , self .managed_graphics ):
138
+ g .cmap = name
139
+
140
+ elif isinstance (names , str ):
141
+ for g in self .managed_graphics :
142
+ g .cmap = names
143
+
116
144
@property
117
145
def data (self ) -> List [np .ndarray ]:
118
146
"""data currently displayed in the widget"""
You can’t perform that action at this time.
0 commit comments