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

Method _get_extension_lengths

lib/matplotlib/colorbar.py:1285–1308  ·  view source on GitHub ↗

Return the lengths of colorbar extensions. This is a helper method for _uniform_y and _proportional_y.

(self, frac, automin, automax, default=0.05)

Source from the content-addressed store, hash-verified

1283 return y, extendlength
1284
1285 def _get_extension_lengths(self, frac, automin, automax, default=0.05):
1286 """
1287 Return the lengths of colorbar extensions.
1288
1289 This is a helper method for _uniform_y and _proportional_y.
1290 """
1291 # Set the default value.
1292 extendlength = np.array([default, default])
1293 if isinstance(frac, str):
1294 _api.check_in_list(['auto'], extendfrac=frac.lower())
1295 # Use the provided values when 'auto' is required.
1296 extendlength[:] = [automin, automax]
1297 elif frac is not None:
1298 try:
1299 # Try to set min and max extension fractions directly.
1300 extendlength[:] = frac
1301 # If frac is a sequence containing None then NaN may
1302 # be encountered. This is an error.
1303 if np.isnan(extendlength).any():
1304 raise ValueError()
1305 except (TypeError, ValueError) as err:
1306 # Raise an error on encountering an invalid value for frac.
1307 raise ValueError('invalid value for extendfrac') from err
1308 return extendlength
1309
1310 def _extend_lower(self):
1311 """Return whether the lower limit is open ended."""

Callers 2

_uniform_yMethod · 0.95
_proportional_yMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected