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

Method shrunk_to_aspect

lib/matplotlib/transforms.py:538–560  ·  view source on GitHub ↗

Return a copy of the `Bbox`, shrunk so that it is as large as it can be while having the desired aspect ratio, *box_aspect*. If the box coordinates are relative (i.e. fractions of a larger box such as a figure) then the physical aspect ratio of that figure i

(self, box_aspect, container=None, fig_aspect=1.0)

Source from the content-addressed store, hash-verified

536 self._points[0] + [mx * w, my * h]])
537
538 def shrunk_to_aspect(self, box_aspect, container=None, fig_aspect=1.0):
539 """
540 Return a copy of the `Bbox`, shrunk so that it is as
541 large as it can be while having the desired aspect ratio,
542 *box_aspect*. If the box coordinates are relative (i.e.
543 fractions of a larger box such as a figure) then the
544 physical aspect ratio of that figure is specified with
545 *fig_aspect*, so that *box_aspect* can also be given as a
546 ratio of the absolute dimensions, not the relative dimensions.
547 """
548 if box_aspect <= 0 or fig_aspect <= 0:
549 raise ValueError("'box_aspect' and 'fig_aspect' must be positive")
550 if container is None:
551 container = self
552 w, h = container.size
553 H = w * box_aspect / fig_aspect
554 if H <= h:
555 W = w
556 else:
557 W = h * fig_aspect / box_aspect
558 H = h
559 return Bbox([self._points[0],
560 self._points[0] + (W, H)])
561
562 def splitx(self, *args):
563 """

Callers 2

apply_aspectMethod · 0.80
apply_aspectMethod · 0.80

Calls 1

BboxClass · 0.85

Tested by

no test coverage detected