'Use :meth:`_aspect` and :meth:`_adjustable` to modify the
axes box or the view limits.'

def apply_aspect(self, position=None):

    if (position is None):
        position = self.get_position(original=True)
    aspect = self.get_aspect()
    if (self.name != u'polar'):
        (xscale, yscale) = (self.get_xscale(), self.get_yscale())
        if ((xscale == u'linear') and (yscale == u'linear')):
            aspect_scale_mode = u'linear'
        elif ((xscale == u'log') and (yscale == u'log')):
            aspect_scale_mode = u'log'
        elif (((xscale == u'linear') and (yscale == u'log')) or ((xscale == u'log') and (yscale == u'linear'))):
            if (aspect != u'auto'):
                warnings.warn((u'aspect    is    not    supported    for    Axes    with    xscale=%s,    yscale=%s' % (xscale, yscale)))
                aspect = u'auto'
        else:
            pass
    else:
        aspect_scale_mode = u'linear'
    if (aspect == u'auto'):
        self.set_position(position, which=u'active')
        return
    if (aspect == u'equal'):
        A = 1
    else:
        A = aspect
    if ((self in self._shared_x_axes) or (self in self._shared_y_axes)):
        if (self._adjustable == u'box'):
            self._adjustable = u'datalim'
            warnings.warn(u'shared    axes:    "adjustable"    is    being    changed    to    "datalim"')
    (figW, figH) = self.get_figure().get_size_inches()
    fig_aspect = (figH / figW)
    if (self._adjustable in [u'box', u'box-forced']):
        if (aspect_scale_mode == u'log'):
            box_aspect = (A * self.get_data_ratio_log())
        else:
            box_aspect = (A * self.get_data_ratio())
        pb = position.frozen()
        pb1 = pb.shrunk_to_aspect(box_aspect, pb, fig_aspect)
        self.set_position(pb1.anchored(self.get_anchor(), pb), u'active')
        return
    self.set_position(position, which=u'active')
    (xmin, xmax) = self.get_xbound()
    (ymin, ymax) = self.get_ybound()
    if (aspect_scale_mode == u'log'):
        (xmin, xmax) = (math.log10(xmin), math.log10(xmax))
        (ymin, ymax) = (math.log10(ymin), math.log10(ymax))
    xsize = max(abs((xmax - xmin)), 1e-30)
    ysize = max(abs((ymax - ymin)), 1e-30)
    (l, b, w, h) = position.bounds
    box_aspect = (fig_aspect * (h / w))
    data_ratio = (box_aspect / A)
    y_expander = (((data_ratio * xsize) / ysize) - 1.0)
    if (abs(y_expander) < 0.005):
        return
    if (aspect_scale_mode == u'log'):
        dL = self.dataLim
        dL_width = (math.log10(dL.x1) - math.log10(dL.x0))
        dL_height = (math.log10(dL.y1) - math.log10(dL.y0))
        xr = (1.05 * dL_width)
        yr = (1.05 * dL_height)
    else:
        dL = self.dataLim
        xr = (1.05 * dL.width)
        yr = (1.05 * dL.height)
    xmarg = (xsize - xr)
    ymarg = (ysize - yr)
    Ysize = (data_ratio * xsize)
    Xsize = (ysize / data_ratio)
    Xmarg = (Xsize - xr)
    Ymarg = (Ysize - yr)
    xm = 0
    ym = 0
    changex = ((self in self._shared_y_axes) and (self not in self._shared_x_axes))
    changey = ((self in self._shared_x_axes) and (self not in self._shared_y_axes))
    if (changex and changey):
        warnings.warn(u"adjustable='datalim'    cannot    work    with    shared    x    and    y    axes")
        return
    if changex:
        adjust_y = False
    else:
        if ((xmarg > xm) and (ymarg > ym)):
            adjy = (((Ymarg > 0) and (y_expander < 0)) or ((Xmarg < 0) and (y_expander > 0)))
        else:
            adjy = (y_expander > 0)
        adjust_y = (changey or adjy)
    if adjust_y:
        yc = (0.5 * (ymin + ymax))
        y0 = (yc - (Ysize / 2.0))
        y1 = (yc + (Ysize / 2.0))
        if (aspect_scale_mode == u'log'):
            self.set_ybound(((10.0 ** y0), (10.0 ** y1)))
        else:
            self.set_ybound((y0, y1))
    else:
        xc = (0.5 * (xmin + xmax))
        x0 = (xc - (Xsize / 2.0))
        x1 = (xc + (Xsize / 2.0))
        if (aspect_scale_mode == u'log'):
            self.set_xbound(((10.0 ** x0), (10.0 ** x1)))
        else:
            self.set_xbound((x0, x1))
