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

Skip to content

Commit 7c6dabb

Browse files
committed
FIX: fix bbox tight
1 parent 0666882 commit 7c6dabb

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

lib/matplotlib/figure.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,6 @@ def _add_axes_internal(self, key, ax):
844844
ax._remove_method = self.delaxes
845845
self.stale = True
846846
ax.stale_callback = _stale_figure_callback
847-
print('Adding Internal', ax)
848847
return ax
849848

850849
@cbook._make_keyword_only("3.3", "sharex")
@@ -1091,7 +1090,10 @@ def legend(self, *args, **kwargs):
10911090
# kwargs['loc'] = extra_args[0]
10921091
# extra_args = extra_args[1:]
10931092
pass
1094-
l = mlegend.Legend(self, handles, labels, *extra_args, **kwargs)
1093+
transform = kwargs.pop('bbox_transform', self.transPanel)
1094+
# explicitly set the bbox transform if the user hasn't.
1095+
l = mlegend.Legend(self, handles, labels, *extra_args,
1096+
bbox_transform=transform, **kwargs)
10951097
self.legends.append(l)
10961098
l._remove_method = self.legends.remove
10971099
self.stale = True
@@ -1161,17 +1163,13 @@ def colorbar(self, mappable, cax=None, ax=None, use_gridspec=True, **kw):
11611163
# Store the value of gca so that we can set it back later on.
11621164
current_ax = self.gca()
11631165
artists = self._get_draw_artists(self.canvas.get_renderer())
1164-
print('Before', artists)
11651166
if cax is None:
11661167
if use_gridspec and isinstance(ax, SubplotBase) \
11671168
and (not self.get_constrained_layout()):
11681169
cax, kw = cbar.make_axes_gridspec(ax, **kw)
11691170
else:
1170-
print('Here')
11711171
cax, kw = cbar.make_axes(ax, **kw)
11721172
artists = self._get_draw_artists(self.canvas.get_renderer())
1173-
print('After', artists)
1174-
print('cax out', cax)
11751173

11761174
# need to remove kws that cannot be passed to Colorbar
11771175
NON_COLORBAR_KEYS = ['fraction', 'pad', 'shrink', 'aspect', 'anchor',
@@ -2694,8 +2692,7 @@ def draw(self, renderer):
26942692
return
26952693

26962694
artists = self._get_draw_artists(renderer)
2697-
print('artists', artists)
2698-
2695+
26992696
try:
27002697
renderer.open_group('figure', gid=self.get_gid())
27012698
if self.get_constrained_layout() and self.axes:

0 commit comments

Comments
 (0)