Set the value array from array-like *A*. Parameters ---------- A : array-like or None The values that are mapped to colors. The base class `.ScalarMappable` does not make any assumptions on the dimensionality and shape of the val
(self, A)
| 559 | self.callbacks = cbook.CallbackRegistry(signals=["changed"]) |
| 560 | |
| 561 | def set_array(self, A): |
| 562 | """ |
| 563 | Set the value array from array-like *A*. |
| 564 | |
| 565 | Parameters |
| 566 | ---------- |
| 567 | A : array-like or None |
| 568 | The values that are mapped to colors. |
| 569 | |
| 570 | The base class `.ScalarMappable` does not make any assumptions on |
| 571 | the dimensionality and shape of the value array *A*. |
| 572 | """ |
| 573 | if A is None: |
| 574 | self._A = None |
| 575 | return |
| 576 | |
| 577 | A = _ensure_multivariate_data(A, self.norm.n_components) |
| 578 | |
| 579 | A = cbook.safe_masked_invalid(A, copy=True) |
| 580 | if not np.can_cast(A.dtype, float, "same_kind"): |
| 581 | if A.dtype.fields is None: |
| 582 | |
| 583 | raise TypeError(f"Image data of dtype {A.dtype} cannot be " |
| 584 | f"converted to float") |
| 585 | else: |
| 586 | for key in A.dtype.fields: |
| 587 | if not np.can_cast(A[key].dtype, float, "same_kind"): |
| 588 | raise TypeError(f"Image data of dtype {A.dtype} cannot be " |
| 589 | f"converted to a sequence of floats") |
| 590 | self._A = A |
| 591 | if not self.norm.scaled(): |
| 592 | self._colorizer.autoscale_None(A) |
| 593 | |
| 594 | def get_array(self): |
| 595 | """ |
nothing calls this directly
no test coverage detected