Repository: geopandas/geopandas

Issue:
Plot categories changed in 0.4.0
My apologies if this was raised before, I haven't had the time to do a proper issue search. 

The following code used to create a multicolor plot in geopandas 0.3.0 but not 0.4.0 (or master).

Here the file: [clusters.tar.gz](https://github.com/geopandas/geopandas/files/2667357/clusters.tar.gz)

```python
import geopandas as gpd
import matplotlib.pyplot as plt
import matplotlib

print(gpd.__version__)
print(matplotlib.__version__)
df = gpd.read_file('tar://clusters.tar.gz')
df.plot(column='cluster_id', edgecolor='k', cmap='YlOrRd');
```

Outputs:

```
0.4.0
3.0.2

/home/mowglie/.pyvirtualenvs/py3/lib/python3.5/site-packages/numpy/core/_methods.py:32: RuntimeWarning: invalid value encountered in reduce
  return umr_minimum(a, axis, None, out, keepdims, initial)
/home/mowglie/.pyvirtualenvs/py3/lib/python3.5/site-packages/numpy/core/_methods.py:28: RuntimeWarning: invalid value encountered in reduce
  return umr_maximum(a, axis, None, out, keepdims, initial)
/home/mowglie/.pyvirtualenvs/py3/lib/python3.5/site-packages/matplotlib/colors.py:512: RuntimeWarning: invalid value encountered in less
  xa[xa < 0] = -1
```

![index](https://user-images.githubusercontent.com/10050469/49798135-dc911f80-fd41-11e8-916a-0b0363b47c87.png)

And in 0.3:

```
0.3.0
3.0.2

/home/mowglie/.pyvirtualenvs/py3/lib/python3.5/site-packages/matplotlib/colors.py:512: RuntimeWarning: invalid value encountered in less
  xa[xa < 0] = -1
```
![index](https://user-images.githubusercontent.com/10050469/49798337-52958680-fd42-11e8-96a9-e7d84bbaca77.png)



Discussion:
(note: also the warning is a bit annoying but this is maybe my data)
[The warning seems to be thrown by `numpy`, maybe due to `NaN`s in your dataset.](https://github.com/Unidata/netcdf4-python/issues/766)
sorry for not seeing that, too much on my plate right now -> removing NaNs also solves the plot.

It used to be more robust in geopandas v0.3, though. Should I leave the issue open?
It is caused by changes in #770. Removing NaNs solves the issue only partially. In 0.3 you those shapes with NaNs were also plotted. I think they should be plotted, just with no value. Opinions?
> I think they should be plotted, just with no value. Opinions?

I agree: like matplotlib's imshow or pcolormesh where NaNs are displayed with white (default) or any color specified by the user in cmap.set_bad()
Got it. `mn = values.min() if vmin is None else vmin` and `mx = values.max() if vmax is None else vmax` are both returning `nan`. That's why it does not plot colours - it is passing range from nan to nan. 
Previous version was passing Series, which ignores NaNs in min() and max(). Now it is passing numpy array which returns NaN for min() and max(),
I'll make PR to fix it.

Resolving patch:
diff --git a/geopandas/plotting.py b/geopandas/plotting.py
--- a/geopandas/plotting.py
+++ b/geopandas/plotting.py
@@ -453,8 +453,8 @@ def plot_dataframe(df, column=None, cmap=None, color=None, ax=None,
                       for i in range(len(binedges)-1)]
         values = np.array(binning.yb)
 
-    mn = values.min() if vmin is None else vmin
-    mx = values.max() if vmax is None else vmax
+    mn = values[~np.isnan(values)].min() if vmin is None else vmin
+    mx = values[~np.isnan(values)].max() if vmax is None else vmax
 
     geom_types = df.geometry.type
     poly_idx = np.asarray((geom_types == 'Polygon')


Test patch:
diff --git a/geopandas/tests/test_plotting.py b/geopandas/tests/test_plotting.py
--- a/geopandas/tests/test_plotting.py
+++ b/geopandas/tests/test_plotting.py
@@ -261,6 +261,10 @@ def setup_method(self):
         self.df2 = GeoDataFrame({'geometry': [multipoly1, multipoly2],
                                  'values': [0, 1]})
 
+        t3 = Polygon([(2, 0), (3, 0), (3, 1)])
+        df_nan = GeoDataFrame({'geometry': t3, 'values': [np.nan]})
+        self.df3 = self.df.append(df_nan)
+
     def test_single_color(self):
 
         ax = self.polys.plot(color='green')
@@ -290,6 +294,12 @@ def test_vmin_vmax(self):
         actual_colors = ax.collections[0].get_facecolors()
         np.testing.assert_array_equal(actual_colors[0], actual_colors[1])
 
+        # vmin vmax set correctly for array with NaN (GitHub issue 877)
+        ax = self.df3.plot(column='values')
+        actual_colors = ax.collections[0].get_facecolors()
+        assert np.any(np.not_equal(actual_colors[0], actual_colors[1]))
+
+
     def test_style_kwargs(self):
 
         # facecolor overrides default cmap when color is not set