html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/issues/1780#issuecomment-351825070,https://api.github.com/repos/pydata/xarray/issues/1780,351825070,MDEyOklzc3VlQ29tbWVudDM1MTgyNTA3MA==,10050469,2017-12-14T20:21:18Z,2017-12-14T20:21:18Z,MEMBER,"> imshow with all NaNs works for me on matplotlib 1.5.2
ups yes, I might have been confused by the warning, but it does work with latest mpl yes. The warning says:
```
In [1]: import numpy as np
In [2]: import matplotlib.pyplot as plt
In [3]: a = np.full((2, 2), np.NaN)
In [4]: plt.imshow(a)
Out[4]:
In [5]: plt.show()
/home/mowglie/.pyvirtualenvs/py3/lib/python3.5/site-packages/matplotlib/colors.py:897: UserWarning: Warning: converting a masked element to nan.
dtype = np.min_scalar_type(value)
/home/mowglie/.pyvirtualenvs/py3/lib/python3.5/site-packages/numpy/ma/core.py:748: UserWarning: Warning: converting a masked element to nan.
data = np.array(a, copy=False, subok=subok)
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,282000017
https://github.com/pydata/xarray/issues/1780#issuecomment-351785207,https://api.github.com/repos/pydata/xarray/issues/1780,351785207,MDEyOklzc3VlQ29tbWVudDM1MTc4NTIwNw==,1217238,2017-12-14T17:46:20Z,2017-12-14T17:46:20Z,MEMBER,"@fmaussion what version of matplotlib are you using? imshow with all NaNs works for me on matplotlib 1.5.2 (yes, we're stuck in the dark ages). This might be a regression in matplotlib.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,282000017
https://github.com/pydata/xarray/issues/1780#issuecomment-351678963,https://api.github.com/repos/pydata/xarray/issues/1780,351678963,MDEyOklzc3VlQ29tbWVudDM1MTY3ODk2Mw==,10050469,2017-12-14T11:01:04Z,2017-12-14T12:15:34Z,MEMBER,"> I'm willing to write the patch, if that helps!
Yes, thanks! The best place to start would be to add a test to `Common2dMixin` (https://github.com/pydata/xarray/blob/master/xarray/tests/test_plot.py#L560).
I investigated a bit and it seems that in the case of all nan data you would probably have to force `add_colorbar` to False and do other things for matplotlib to accept your all nan data.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,282000017
https://github.com/pydata/xarray/issues/1780#issuecomment-351663421,https://api.github.com/repos/pydata/xarray/issues/1780,351663421,MDEyOklzc3VlQ29tbWVudDM1MTY2MzQyMQ==,10050469,2017-12-14T09:57:51Z,2017-12-14T09:57:51Z,MEMBER,"Actually I changed my mind a little bit ;-). Matplotlib won't plot all NaNs images either:
```python
import numpy as np
import matplotlib.pyplot as plt
a = np.full((2, 2), np.NaN)
plt.imshow(a)
plt.show() # raises an error
```
So we have to decide if it's worth to add a bunch of logic in xarray to handle these cases or if it's the user's responsibility to check the data before plotting.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,282000017
https://github.com/pydata/xarray/issues/1780#issuecomment-351661580,https://api.github.com/repos/pydata/xarray/issues/1780,351661580,MDEyOklzc3VlQ29tbWVudDM1MTY2MTU4MA==,10050469,2017-12-14T09:51:01Z,2017-12-14T09:51:01Z,MEMBER,"Yes, I agree. We inherited the logic from seaborn, which also has this problem:
```python
In [2]: import seaborn as sns
In [3]: import numpy as np
In [4]: a = np.zeros((2, 2)) * np.NaN
In [6]: sns.heatmap(a)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in ()
----> 1 sns.heatmap(a)
~/.pyvirtualenvs/py3/lib/python3.5/site-packages/seaborn/matrix.py in heatmap(data, vmin, vmax, cmap, center, robust, annot, fmt, annot_kws, linewidths, linecolor, cbar, cbar_kws, cbar_ax, square, xticklabels, yticklabels, mask, ax, **kwargs)
515 plotter = _HeatMapper(data, vmin, vmax, cmap, center, robust, annot, fmt,
516 annot_kws, cbar, cbar_kws, xticklabels,
--> 517 yticklabels, mask)
518
519 # Add the pcolormesh kwargs here
~/.pyvirtualenvs/py3/lib/python3.5/site-packages/seaborn/matrix.py in __init__(self, data, vmin, vmax, cmap, center, robust, annot, fmt, annot_kws, cbar, cbar_kws, xticklabels, yticklabels, mask)
166 # Determine good default values for the colormapping
167 self._determine_cmap_params(plot_data, vmin, vmax,
--> 168 cmap, center, robust)
169
170 # Sort out the annotations
~/.pyvirtualenvs/py3/lib/python3.5/site-packages/seaborn/matrix.py in _determine_cmap_params(self, plot_data, vmin, vmax, cmap, center, robust)
205 calc_data = plot_data.data[~np.isnan(plot_data.data)]
206 if vmin is None:
--> 207 vmin = np.percentile(calc_data, 2) if robust else calc_data.min()
208 if vmax is None:
209 vmax = np.percentile(calc_data, 98) if robust else calc_data.max()
~/.pyvirtualenvs/py3/lib/python3.5/site-packages/numpy/core/_methods.py in _amin(a, axis, out, keepdims)
27
28 def _amin(a, axis=None, out=None, keepdims=False):
---> 29 return umr_minimum(a, axis, None, out, keepdims)
30
31 def _sum(a, axis=None, dtype=None, out=None, keepdims=False):
ValueError: zero-size array to reduction operation minimum which has no identity
```
Will try to submit a fix later today","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,282000017