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

Skip to content

Commit f23d9e0

Browse files
committed
pr changes addressed
1 parent 681abfe commit f23d9e0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,8 +2950,6 @@ def _update_title_position(self, renderer):
29502950
_log.debug('title position was updated manually, not adjusting')
29512951
return
29522952

2953-
titles = []
2954-
29552953
titles = [self.title, self._left_title, self._right_title]
29562954

29572955
for title in titles:
@@ -3004,14 +3002,15 @@ def _update_title_position(self, renderer):
30043002
(0., 2 * top - title.get_window_extent(renderer).ymin))
30053003
title.set_position((x, y))
30063004

3007-
grouped_axs = self.figure._align_title_groups.get_siblings(self)
30083005
ymax = max(title.get_position()[1] for title in titles)
30093006
for title in titles:
30103007
# now line up all the titles at the highest baseline.
30113008
x, _ = title.get_position()
30123009
title.set_position((x, ymax))
30133010

30143011
# Align bboxes of grouped axes to highest in group
3012+
grouped_axs = self.figure._align_label_groups['title'] \
3013+
.get_siblings(self)
30153014
bb_ymax = None
30163015
ax_max = None
30173016
for ax in grouped_axs:

lib/matplotlib/figure.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ def __init__(self, **kwargs):
173173
# groupers to keep track of x and y labels we want to align.
174174
# see self.align_xlabels and self.align_ylabels and
175175
# axis._get_tick_boxes_siblings
176-
self._align_label_groups = {"x": cbook.Grouper(), "y": cbook.Grouper()}
177-
self._align_title_groups = cbook.Grouper()
176+
self._align_label_groups = {"x": cbook.Grouper(), "y": cbook.Grouper(),
177+
"title": cbook.Grouper()}
178178

179179
self.figure = self
180180
# list of child gridspecs for this figure
@@ -1294,7 +1294,7 @@ def align_titles(self, axs=None):
12941294
rowspanc = axc.get_subplotspec().rowspan
12951295
if rowspan.start == rowspanc.start or \
12961296
rowspan.stop == rowspanc.stop:
1297-
self._align_title_groups.join(ax, axc)
1297+
self._align_label_groups['title'].join(ax, axc)
12981298

12991299
def align_ylabels(self, axs=None):
13001300
"""
@@ -2903,6 +2903,7 @@ def draw(self, renderer):
29032903

29042904
artists = self._get_draw_artists(renderer)
29052905
try:
2906+
29062907
renderer.open_group('figure', gid=self.get_gid())
29072908
if self.axes and self.get_layout_engine() is not None:
29082909
try:

0 commit comments

Comments
 (0)