code: def _set_aspect(self, axes, aspect):
          
          if ((isinstance(aspect, util.basestring) and aspect != 'square') or
              self.data_aspect):
              data_ratio = self.data_aspect or aspect
          else:
              (x0, x1), (y0, y1) = axes.get_xlim(), axes.get_ylim()
              xsize = np.log(x1) - np.log(x0) if self.logx else x1-x0
              ysize = np.log(y1) - np.log(y0) if self.logy else y1-y0
              xsize = max(abs(xsize), 1e-30)
              ysize = max(abs(ysize), 1e-30)
              data_ratio = 1./(ysize/xsize)
              if aspect != 'square':
                  data_ratio = data_ratio/aspect
          axes.set_aspect(data_ratio)
docs: Set the aspect on the axes based on the aspect setting.