Set the norm limits for image scaling. Parameters ---------- vmin, vmax : float The limits. For scalar data, the limits may also be passed as a tuple (*vmin*, *vmax*) single positional argument. .. ACCEPTS: (vmin
(self, vmin=None, vmax=None)
| 238 | self._set_cmap(cmap) |
| 239 | |
| 240 | def set_clim(self, vmin=None, vmax=None): |
| 241 | """ |
| 242 | Set the norm limits for image scaling. |
| 243 | |
| 244 | Parameters |
| 245 | ---------- |
| 246 | vmin, vmax : float |
| 247 | The limits. |
| 248 | |
| 249 | For scalar data, the limits may also be passed as a |
| 250 | tuple (*vmin*, *vmax*) single positional argument. |
| 251 | |
| 252 | .. ACCEPTS: (vmin: float, vmax: float) |
| 253 | """ |
| 254 | if self.norm.n_components == 1: |
| 255 | if vmax is None: |
| 256 | try: |
| 257 | vmin, vmax = vmin |
| 258 | except (TypeError, ValueError): |
| 259 | pass |
| 260 | |
| 261 | orig_vmin_vmax = self.norm.vmin, self.norm.vmax |
| 262 | |
| 263 | # Blocked context manager prevents callbacks from being triggered |
| 264 | # until both vmin and vmax are updated |
| 265 | with self.norm.callbacks.blocked(signal='changed'): |
| 266 | # Since the @vmin/vmax.setter invokes colors._sanitize_extrema() |
| 267 | # to sanitize the input, the input is not sanitized here |
| 268 | if vmin is not None: |
| 269 | self.norm.vmin = vmin |
| 270 | if vmax is not None: |
| 271 | self.norm.vmax = vmax |
| 272 | |
| 273 | # emit a update signal if the limits are changed |
| 274 | if orig_vmin_vmax != (self.norm.vmin, self.norm.vmax): |
| 275 | self.norm.callbacks.process('changed') |
| 276 | |
| 277 | def get_clim(self): |
| 278 | """ |