Commit 5d15e7c
Nathan Goldbaum
Ensure image scale factors are scalars
This avoids errors that get triggered by passing an ndarray subclass to
imshow.
For example:
```python
import numpy as np
from yt.units import km
from matplotlib import pyplot as plt
data = np.random.random((100, 100))*km
plt.imshow(data)
plt.show()
```
Or similarly with `astropy`:
```python
import numpy as np
from astropy.units import km
from matplotlib import pyplot as plt
data = np.random.random((100, 100))*km
plt.imshow(data)
plt.show()
```
Before this patch, both of these commands raise an error because `a_min` and
`a_max` have units attached. By explicitly converting these to scalars we
avoid this failure mode.1 parent 4b5f6e3 commit 5d15e7c
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
397 | | - | |
398 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
399 | 401 | | |
400 | 402 | | |
401 | 403 | | |
| |||
0 commit comments