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: diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index 20273a6f06fe..354d998a10d0 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,12 @@ 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, + zorder=2) ax.add_artist(self.outline) self.outline.set_clip_box(None) self.outline.set_clip_path(None)