calculate appropriate sizes for the subfigures

def getfigsize(self, opt):
        '''calculate appropriate sizes for the subfigures
        '''
        if opt.xmin is None:
            opt.xmin = self.plotman.grid.grid['x'].min()
        if opt.xmax is None:
            opt.xmax = self.plotman.grid.grid['x'].max()
        if opt.zmin is None:
            opt.zmin = self.plotman.grid.grid['z'].min()
        if opt.zmax is None:
            opt.zmax = self.plotman.grid.grid['z'].max()
        if np.abs(opt.zmax - opt.zmin) < np.abs(opt.xmax - opt.xmin):
            self.sizex = 2 / 2.54
            self.sizez = self.sizex * (
                    np.abs(opt.zmax - opt.zmin) / np.abs(opt.xmax - opt.xmin))
        else:
            self.sizez = 2 / 2.54
            self.sizex = 0.5 * self.sizez * (
                    np.abs(opt.xmax - opt.xmin) / np.abs(opt.zmax - opt.zmin))
            print('schmal')
        # add 1 inch to accommodate colorbar
        self.sizex += 4 * .5
        self.sizex *= 4
        self.sizez *= self.rows
        self.sizez += 5