From 17a3ead0676977e6be24ef5b9899f0d81a1e95ce Mon Sep 17 00:00:00 2001 From: David Stansby Date: Tue, 22 Nov 2016 16:20:36 +0000 Subject: [PATCH 1/3] Set hexbin default linecolor to 'face' --- lib/matplotlib/axes/_axes.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 12dbffc27ac8..e38ddde410fa 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -4069,7 +4069,7 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None, def hexbin(self, x, y, C=None, gridsize=100, bins=None, xscale='linear', yscale='linear', extent=None, cmap=None, norm=None, vmin=None, vmax=None, - alpha=None, linewidths=None, edgecolors='none', + alpha=None, linewidths=None, edgecolors='face', reduce_C_function=np.mean, mincnt=None, marginals=False, **kwargs): """ @@ -4163,10 +4163,12 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None, linewidths : scalar, optional, default is *None* If *None*, defaults to 1.0. - edgecolors : {'none'} or mpl color, optional, default is 'none' - If 'none', draws the edges in the same color as the fill color. - This is the default, as it avoids unsightly unpainted pixels - between the hexagons. + edgecolors : {'face', 'none', *None*} or mpl color, optional, default is 'face' + + If 'face', draws the edges in the same color as the fill color. + + If 'none', no edge is drawn; this can sometimes lead to unsightly + unpainted pixels between the hexagons. If *None*, draws outlines in the default color. @@ -4353,8 +4355,6 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None, polygon[:, 0] = sx * np.array([0.5, 0.5, 0.0, -0.5, -0.5, 0.0]) polygon[:, 1] = sy * np.array([-0.5, 0.5, 1.0, 0.5, -0.5, -1.0]) / 3.0 - if edgecolors == 'none': - edgecolors = 'face' if linewidths is None: linewidths = [1.0] From 6f1a9449533ecd2260f8f5072eb30e7e49be7f3f Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 23 Nov 2016 21:20:37 +0000 Subject: [PATCH 2/3] Make hexbin docstring PEP8 compliant --- lib/matplotlib/axes/_axes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index e38ddde410fa..3b1554580f41 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -4163,7 +4163,8 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None, linewidths : scalar, optional, default is *None* If *None*, defaults to 1.0. - edgecolors : {'face', 'none', *None*} or mpl color, optional, default is 'face' + edgecolors : {'face', 'none', *None*} or mpl color, optional, default\ + is 'face' If 'face', draws the edges in the same color as the fill color. From f97879dc01d4a7079c6f815b94421e5f1ec64c62 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 23 Nov 2016 21:57:53 +0000 Subject: [PATCH 3/3] Document hexbin linecolor kwarg changes --- doc/users/dflt_style_changes.rst | 7 +++++++ doc/users/whats_new/default_hexbin_linecolor.rst | 5 +++++ 2 files changed, 12 insertions(+) create mode 100644 doc/users/whats_new/default_hexbin_linecolor.rst diff --git a/doc/users/dflt_style_changes.rst b/doc/users/dflt_style_changes.rst index c2490073114a..8a01fa699656 100644 --- a/doc/users/dflt_style_changes.rst +++ b/doc/users/dflt_style_changes.rst @@ -560,6 +560,13 @@ or by setting:: in your :file:`matplotlibrc` file. +``hexbin`` +---------- + +The default value of the ``linecolor`` kwarg for `~matplotlib.Axes.hexbin` has +changed from ``'none'`` to ``'face'``. If 'none' is now supplied, no line edges +are drawn around the hexagons. + ``bar`` and ``barh`` ==================== diff --git a/doc/users/whats_new/default_hexbin_linecolor.rst b/doc/users/whats_new/default_hexbin_linecolor.rst new file mode 100644 index 000000000000..df26a7b2e1a3 --- /dev/null +++ b/doc/users/whats_new/default_hexbin_linecolor.rst @@ -0,0 +1,5 @@ +Hexbin default line color +------------------------- + +The default ``linecolor`` kwarg for :func:`hexbin` is now ``'face'``, and +supplying ``'none'`` now prevents lines from being drawn around the hexagons.