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

Method _autoscale_axis

lib/mpl_toolkits/mplot3d/axes3d.py:657–691  ·  view source on GitHub ↗

Autoscale a single axis. Parameters ---------- axis : Axis The axis to autoscale. v0, v1 : float Data interval limits. minpos : float Minimum positive value for log-scale handling. margin : float

(self, axis, v0, v1, minpos, margin, set_bound, _tight)

Source from the content-addressed store, hash-verified

655 self.autoscale_view()
656
657 def _autoscale_axis(self, axis, v0, v1, minpos, margin, set_bound, _tight):
658 """
659 Autoscale a single axis.
660
661 Parameters
662 ----------
663 axis : Axis
664 The axis to autoscale.
665 v0, v1 : float
666 Data interval limits.
667 minpos : float
668 Minimum positive value for log-scale handling.
669 margin : float
670 Margin to apply (e.g., self._xmargin).
671 set_bound : callable
672 Function to set the axis bound (e.g., self.set_xbound).
673 _tight : bool
674 Whether to use tight bounds.
675 """
676 locator = axis.get_major_locator()
677 v0, v1 = locator.nonsingular(v0, v1)
678 # Validate limits for the scale (e.g., positive for log scale)
679 v0, v1 = axis._scale.limit_range_for_scale(v0, v1, minpos)
680 if margin > 0:
681 # Apply margin in transformed space to handle non-linear scales
682 transform = axis.get_transform()
683 inverse_trans = transform.inverted()
684 v0t, v1t = transform.transform([v0, v1])
685 delta = (v1t - v0t) * margin
686 if not np.isfinite(delta):
687 delta = 0
688 v0, v1 = inverse_trans.transform([v0t - delta, v1t + delta])
689 if not _tight:
690 v0, v1 = locator.view_limits(v0, v1)
691 set_bound(v0, v1, self._view_margin)
692
693 def autoscale_view(self, tight=None,
694 scalex=True, scaley=True, scalez=True):

Callers 1

autoscale_viewMethod · 0.95

Calls 7

get_major_locatorMethod · 0.80
nonsingularMethod · 0.45
limit_range_for_scaleMethod · 0.45
get_transformMethod · 0.45
invertedMethod · 0.45
transformMethod · 0.45
view_limitsMethod · 0.45

Tested by

no test coverage detected