@@ -99,44 +99,42 @@ def do_constrained_layout(fig, renderer, h_pad, w_pad,
9999
100100 """
101101
102- ''' Steps:
103-
104- 1. get a list of unique gridspecs in this figure. Each gridspec will be
105- constrained separately.
106- 2. Check for gaps in the gridspecs. i.e. if not every axes slot in the
107- gridspec has been filled. If empty, add a ghost axis that is made so
108- that it cannot be seen (though visible=True). This is needed to make
109- a blank spot in the layout.
110- 3. Compare the tight_bbox of each axes to its `position`, and assume that
111- the difference is the space needed by the elements around the edge of
112- the axes (decorations) like the title, ticklabels, x-labels, etc. This
113- can include legends who overspill the axes boundaries.
114- 4. Constrain gridspec elements to line up:
115- a) if colnum0 != colnumC, the two subplotspecs are stacked next to
116- each other, with the appropriate order.
117- b) if colnum0 == colnumC, line up the left or right side of the
118- _poslayoutbox (depending if it is the min or max num that is equal).
119- c) do the same for rows...
120- 5. The above doesn't constrain relative sizes of the _poslayoutboxes at
121- all, and indeed zero-size is a solution that the solver often finds more
122- convenient than expanding the sizes. Right now the solution is to compare
123- subplotspec sizes (i.e. drowsC and drows0) and constrain the larger
124- _poslayoutbox to be larger than the ratio of the sizes. i.e. if drows0 >
125- drowsC, then ax._poslayoutbox > axc._poslayoutbox * drowsC / drows0. This
126- works fine *if* the decorations are similar between the axes. If the
127- larger subplotspec has much larger axes decorations, then the constraint
128- above is incorrect.
129-
130- We need the greater than in the above, in general, rather than an equals
131- sign. Consider the case of the left column having 2 rows, and the right
132- column having 1 row. We want the top and bottom of the _poslayoutboxes to
133- line up. So that means if there are decorations on the left column axes
134- they will be smaller than half as large as the right hand axis.
135-
136- This can break down if the decoration size for the right hand axis (the
137- margins) is very large. There must be a math way to check for this case.
138-
139- '''
102+ # Steps:
103+ #
104+ # 1. get a list of unique gridspecs in this figure. Each gridspec will be
105+ # constrained separately.
106+ # 2. Check for gaps in the gridspecs. i.e. if not every axes slot in the
107+ # gridspec has been filled. If empty, add a ghost axis that is made so
108+ # that it cannot be seen (though visible=True). This is needed to make
109+ # a blank spot in the layout.
110+ # 3. Compare the tight_bbox of each axes to its `position`, and assume that
111+ # the difference is the space needed by the elements around the edge of
112+ # the axes (decorations) like the title, ticklabels, x-labels, etc. This
113+ # can include legends who overspill the axes boundaries.
114+ # 4. Constrain gridspec elements to line up:
115+ # a) if colnum0 != colnumC, the two subplotspecs are stacked next to
116+ # each other, with the appropriate order.
117+ # b) if colnum0 == colnumC, line up the left or right side of the
118+ # _poslayoutbox (depending if it is the min or max num that is equal).
119+ # c) do the same for rows...
120+ # 5. The above doesn't constrain relative sizes of the _poslayoutboxes
121+ # at all, and indeed zero-size is a solution that the solver often finds
122+ # more convenient than expanding the sizes. Right now the solution is to
123+ # compare subplotspec sizes (i.e. drowsC and drows0) and constrain the
124+ # larger _poslayoutbox to be larger than the ratio of the sizes. i.e. if
125+ # drows0 > drowsC, then ax._poslayoutbox > axc._poslayoutbox*drowsC/drows0.
126+ # This works fine *if* the decorations are similar between the axes.
127+ # If the larger subplotspec has much larger axes decorations, then the
128+ # constraint above is incorrect.
129+ #
130+ # We need the greater than in the above, in general, rather than an equals
131+ # sign. Consider the case of the left column having 2 rows, and the right
132+ # column having 1 row. We want the top and bottom of the _poslayoutboxes
133+ # to line up. So that means if there are decorations on the left column
134+ # axes they will be smaller than half as large as the right hand axis.
135+ #
136+ # This can break down if the decoration size for the right hand axis (the
137+ # margins) is very large. There must be a math way to check for this case.
140138
141139 invTransFig = fig .transFigure .inverted ().transform_bbox
142140
0 commit comments