From 54f047a564433baedc9da0fea3e78e11985afaf4 Mon Sep 17 00:00:00 2001 From: Stephan Hoyer Date: Wed, 15 Oct 2014 17:50:52 -0700 Subject: [PATCH] Switch default colormap for scatterplot to 'Greys' In #7780, I added colormap support to scatter, but choose to override the default rainbow colormap (7780#issuecomment-49533995). I'm now regreting choosing 'RdBu' as the default colormap. I think a simple black-white colormap is a more conservative and better default choice for coloring scatter plots -- binary colormaps really only make sense if the data is signed. 'Greys' is also the default colormap set by the seaborn package, and @mwaskom has done far more thinking about colormaps than I have. If possible, I would love to get this in before 0.15 is released, so we don't have to worry about changing how anyone's plots look. CC @sinhrks --- pandas/tests/test_graphics.py | 4 ++-- pandas/tools/plotting.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/tests/test_graphics.py b/pandas/tests/test_graphics.py index 1793d6806be83..1651c9f50e525 100644 --- a/pandas/tests/test_graphics.py +++ b/pandas/tests/test_graphics.py @@ -1605,8 +1605,8 @@ def test_plot_scatter_with_c(self): axes = [df.plot(kind='scatter', x='x', y='y', c='z'), df.plot(kind='scatter', x=0, y=1, c=2)] for ax in axes: - # default to RdBu - self.assertEqual(ax.collections[0].cmap.name, 'RdBu') + # default to Greys + self.assertEqual(ax.collections[0].cmap.name, 'Greys') if self.mpl_ge_1_3_1: diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py index 1d47c3781a7d7..d2c0bcfa5f2a0 100644 --- a/pandas/tools/plotting.py +++ b/pandas/tools/plotting.py @@ -1405,7 +1405,7 @@ def _make_plot(self): cb = self.kwds.pop('colorbar', self.colormap or c in self.data.columns) # pandas uses colormap, matplotlib uses cmap. - cmap = self.colormap or 'RdBu' + cmap = self.colormap or 'Greys' cmap = plt.cm.get_cmap(cmap) if c is None: