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

Method margins

lib/mpl_toolkits/mplot3d/axes3d.py:569–603  ·  view source on GitHub ↗

Set or retrieve autoscaling margins. See `.Axes.margins` for full documentation. Because this function applies to 3D Axes, it also takes a *z* argument, and returns ``(xmargin, ymargin, zmargin)``.

(self, *margins, x=None, y=None, z=None, tight=True)

Source from the content-addressed store, hash-verified

567 self.stale = True
568
569 def margins(self, *margins, x=None, y=None, z=None, tight=True):
570 """
571 Set or retrieve autoscaling margins.
572
573 See `.Axes.margins` for full documentation. Because this function
574 applies to 3D Axes, it also takes a *z* argument, and returns
575 ``(xmargin, ymargin, zmargin)``.
576 """
577 if margins and (x is not None or y is not None or z is not None):
578 raise TypeError('Cannot pass both positional and keyword '
579 'arguments for x, y, and/or z.')
580 elif len(margins) == 1:
581 x = y = z = margins[0]
582 elif len(margins) == 3:
583 x, y, z = margins
584 elif margins:
585 raise TypeError('Must pass a single positional argument for all '
586 'margins, or one for each margin (x, y, z).')
587
588 if x is None and y is None and z is None:
589 if tight is not True:
590 _api.warn_external(f'ignoring tight={tight!r} in get mode')
591 return self._xmargin, self._ymargin, self._zmargin
592
593 if x is not None:
594 self.set_xmargin(x)
595 if y is not None:
596 self.set_ymargin(y)
597 if z is not None:
598 self.set_zmargin(z)
599
600 self.autoscale_view(
601 tight=tight, scalex=(x is not None), scaley=(y is not None),
602 scalez=(z is not None)
603 )
604
605 def autoscale(self, enable=True, axis='both', tight=None):
606 """

Callers 4

test_autoscaleFunction · 0.45
test_marginsFunction · 0.45
test_margin_gettersFunction · 0.45
test_margins_errorsFunction · 0.45

Calls 4

set_zmarginMethod · 0.95
autoscale_viewMethod · 0.95
set_xmarginMethod · 0.80
set_ymarginMethod · 0.80

Tested by 4

test_autoscaleFunction · 0.36
test_marginsFunction · 0.36
test_margin_gettersFunction · 0.36
test_margins_errorsFunction · 0.36