From 48f594c2e2b05839ea394040b06196f39d9fbfba Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 27 Aug 2013 17:44:14 -0500 Subject: [PATCH 1/3] changed colorbar outline from a Line2D object to a Polygon object fixes issue #2296 --- lib/matplotlib/colorbar.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index 20273a6f06fe..b5e2f745b85b 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -31,7 +31,6 @@ import matplotlib.contour as contour import matplotlib.cm as cm import matplotlib.gridspec as gridspec -import matplotlib.lines as lines import matplotlib.patches as mpatches import matplotlib.path as mpath import matplotlib.ticker as ticker @@ -415,9 +414,11 @@ def _config_axes(self, X, Y): ax.set_ylim(*ax.dataLim.intervaly) if self.outline is not None: self.outline.remove() - self.outline = lines.Line2D( - xy[:, 0], xy[:, 1], color=mpl.rcParams['axes.edgecolor'], - linewidth=mpl.rcParams['axes.linewidth']) + self.outline = mpatches.Polygon( + xy, edgecolor=mpl.rcParams['axes.edgecolor'], + facecolor='none', + linewidth=mpl.rcParams['axes.linewidth'], + closed=True) ax.add_artist(self.outline) self.outline.set_clip_box(None) self.outline.set_clip_path(None) From dd1f6b00d4fdb46c853644376bc5e024d39b5f62 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 27 Aug 2013 18:26:12 -0500 Subject: [PATCH 2/3] tweaked zorder to match line2D's default zorder --- lib/matplotlib/colorbar.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index b5e2f745b85b..354d998a10d0 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -418,7 +418,8 @@ def _config_axes(self, X, Y): xy, edgecolor=mpl.rcParams['axes.edgecolor'], facecolor='none', linewidth=mpl.rcParams['axes.linewidth'], - closed=True) + closed=True, + zorder=2) ax.add_artist(self.outline) self.outline.set_clip_box(None) self.outline.set_clip_path(None) From 75e8e5f9975b21f9de80a64d5971c69f6548c86b Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Wed, 28 Aug 2013 10:42:23 -0500 Subject: [PATCH 3/3] added entry to api_changes for type of `colorbar.ColorbarBase.outline` --- doc/api/api_changes.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/api_changes.rst b/doc/api/api_changes.rst index 721e0549117c..d3bc6d242834 100644 --- a/doc/api/api_changes.rst +++ b/doc/api/api_changes.rst @@ -54,6 +54,10 @@ original location: 'open-close-high-low' order of quotes, and what the module used and the later is 'open-high-low-close' order of quotes, which is the standard in finance. +* The artist used to draw the outline of a `colorbar` has been changed + from a `matplotlib.lines.Line2D` to `matplotlib.patches.Polygon`, + thus `colorbar.ColorbarBase.outline` is now a + `matplotlib.patches.Polygon` object. .. _changes_in_1_3: