Skip to content

Commit 89e53aa

Browse files
committed
Merge pull request matplotlib#2352 from tacaswell/colorbar_outline_fix
changed colorbar outline from a Line2D object to a Polygon object
2 parents bdfdbdf + 75e8e5f commit 89e53aa

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

doc/api/api_changes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ original location:
5454
'open-close-high-low' order of quotes, and what the module used and the later
5555
is 'open-high-low-close' order of quotes, which is the standard in finance.
5656

57+
* The artist used to draw the outline of a `colorbar` has been changed
58+
from a `matplotlib.lines.Line2D` to `matplotlib.patches.Polygon`,
59+
thus `colorbar.ColorbarBase.outline` is now a
60+
`matplotlib.patches.Polygon` object.
5761

5862
.. _changes_in_1_3:
5963

lib/matplotlib/colorbar.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import matplotlib.contour as contour
3232
import matplotlib.cm as cm
3333
import matplotlib.gridspec as gridspec
34-
import matplotlib.lines as lines
3534
import matplotlib.patches as mpatches
3635
import matplotlib.path as mpath
3736
import matplotlib.ticker as ticker
@@ -415,9 +414,12 @@ def _config_axes(self, X, Y):
415414
ax.set_ylim(*ax.dataLim.intervaly)
416415
if self.outline is not None:
417416
self.outline.remove()
418-
self.outline = lines.Line2D(
419-
xy[:, 0], xy[:, 1], color=mpl.rcParams['axes.edgecolor'],
420-
linewidth=mpl.rcParams['axes.linewidth'])
417+
self.outline = mpatches.Polygon(
418+
xy, edgecolor=mpl.rcParams['axes.edgecolor'],
419+
facecolor='none',
420+
linewidth=mpl.rcParams['axes.linewidth'],
421+
closed=True,
422+
zorder=2)
421423
ax.add_artist(self.outline)
422424
self.outline.set_clip_box(None)
423425
self.outline.set_clip_path(None)

0 commit comments

Comments
 (0)