MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / hard_constraints

Method hard_constraints

lib/matplotlib/_layoutgrid.py:139–162  ·  view source on GitHub ↗

These are the redundant constraints, plus ones that make the rest of the code easier.

(self)

Source from the content-addressed store, hash-verified

137 self.grid_constraints()
138
139 def hard_constraints(self):
140 """
141 These are the redundant constraints, plus ones that make the
142 rest of the code easier.
143 """
144 for i in range(self.ncols):
145 hc = [self.rights[i] >= self.lefts[i],
146 (self.rights[i] - self.margins['right'][i] -
147 self.margins['rightcb'][i] >=
148 self.lefts[i] - self.margins['left'][i] -
149 self.margins['leftcb'][i])
150 ]
151 for c in hc:
152 self.solver.addConstraint(c | 'required')
153
154 for i in range(self.nrows):
155 hc = [self.tops[i] >= self.bottoms[i],
156 (self.tops[i] - self.margins['top'][i] -
157 self.margins['topcb'][i] >=
158 self.bottoms[i] - self.margins['bottom'][i] -
159 self.margins['bottomcb'][i])
160 ]
161 for c in hc:
162 self.solver.addConstraint(c | 'required')
163
164 def add_child(self, child, i=0, j=0):
165 # np.ix_ returns the cross product of i and j indices

Callers 1

add_constraintsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected