File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1018,8 +1018,12 @@ def get_cmap_and_norm(self):
10181018 if self .mode == 'Discrete' :
10191019 if len (self .values ) != len (self .colors ) - 1 :
10201020 return None , None
1021- cmap = mpl .colors .ListedColormap (self .colors )
1022- norm = mpl .colors .BoundaryNorm (self .values [::- 1 ], self .num_colors , extend = 'both' ) #todo refactor values to thd_values
1021+ cmap = mpl .colors .ListedColormap (self .colors [::- 1 ])
1022+ values = self .get_values ()
1023+ thds = sorted ([values .min ()] + self .values + [values .max ()])
1024+
1025+ norm = mpl .colors .BoundaryNorm (thds ,
1026+ self .num_colors , extend = 'neither' ) #todo refactor values to thd_values
10231027
10241028 elif self .mode == 'Continuous' :
10251029 norm = norm_klass (vmin = np .min (self .values ), vmax = np .max (self .values ), clip = True )
@@ -1089,6 +1093,11 @@ def _update_num_values(self):
10891093 elif len (self .values ) < self .num_colors - diff :
10901094 self ._add_value ()
10911095
1096+ if self .num_colors >= 5 :
1097+ self .widgets ['otsu_thd' ].disabled = True
1098+ else :
1099+ self .widgets ['otsu_thd' ].disabled = False
1100+
10921101 self ._update_bounds ()
10931102 self .param .trigger ('values' )
10941103 self .update_box ()
You can’t perform that action at this time.
0 commit comments