Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX: make unused spines invisible #12241

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

Merged
merged 1 commit into from
Oct 13, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4172,7 +4172,18 @@ def get_default_bbox_extra_artists(self):
Artists are excluded either by not being visible or
``artist.set_in_layout(False)``.
"""
return [artist for artist in self.get_children()

artists = self.get_children()
if not (self.axison and self._frameon):
# don't do bbox on spines if frame not on.
for spine in self.spines.values():
artists.remove(spine)

if not self.axison:
for _axis in self._get_axis_list():
artists.remove(_axis)

return [artist for artist in artists
if (artist.get_visible() and artist.get_in_layout())]

def get_tightbbox(self, renderer, call_axes_locator=True,
Expand Down
5 changes: 5 additions & 0 deletions lib/mpl_toolkits/mplot3d/axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ def __init__(

self.figure.add_axes(self)

# mplot3d currently manages its own spines and needs these turned off
# for bounding box calculations
for k in self.spines.keys():
self.spines[k].set_visible(False)

def set_axis_off(self):
self._axis3don = False
self.stale = True
Expand Down