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

Skip to content

Commit 924a377

Browse files
committed
FIX: fix bbox tight
1 parent 9001322 commit 924a377

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
@@ -1165,17 +1167,13 @@ def colorbar(self, mappable, cax=None, ax=None, use_gridspec=True, **kw):
11651167
# Store the value of gca so that we can set it back later on.
11661168
current_ax = self.gca()
11671169
artists = self._get_draw_artists(self.canvas.get_renderer())
1168-
print('Before', artists)
11691170
if cax is None:
11701171
if (use_gridspec and isinstance(ax, SubplotBase)
11711172
and not self.get_constrained_layout()):
11721173
cax, kw = cbar.make_axes_gridspec(ax, **kw)
11731174
else:
1174-
print('Here')
11751175
cax, kw = cbar.make_axes(ax, **kw)
11761176
artists = self._get_draw_artists(self.canvas.get_renderer())
1177-
print('After', artists)
1178-
print('cax out', cax)
11791177

11801178
# need to remove kws that cannot be passed to Colorbar
11811179
NON_COLORBAR_KEYS = ['fraction', 'pad', 'shrink', 'aspect', 'anchor',
@@ -2690,8 +2688,7 @@ def draw(self, renderer):
26902688
return
26912689

26922690
artists = self._get_draw_artists(renderer)
2693-
print('artists', artists)
2694-
2691+
26952692
try:
26962693
renderer.open_group('figure', gid=self.get_gid())
26972694
if self.get_constrained_layout() and self.axes:

0 commit comments

Comments
 (0)