Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed colorbar outline from a Line2D object to a Polygon object #2352

Merged
merged 3 commits into from Aug 29, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/api/api_changes.rst
Expand Up @@ -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:

Expand Down
10 changes: 6 additions & 4 deletions lib/matplotlib/colorbar.py
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default zorder is 2 for Line2D and 1 for Patch objects, so maybe the zorder should be explicitly set to 2 here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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)
Expand Down