

def snap(self, xstep, ystep=None, padding=0.0):
    '\n        Snap the rectangle onto a grid, with optional padding.\n\n        :param xstep: The number of intervals to split the x=[0, 1] range into.\n        :param ystep: The number of intervals to split the y=[0, 1] range into.\n        :param padding: Uniform padding to add around the result. This shrinks\n                        the result so that the edges + padding line up with the\n                        grid.\n\n        :returns: A new Rectangle, obtained by snapping self onto the grid,\n                  and applying padding\n        '
    if (ystep is None):
        ystep = xstep
    return Rectangle(((round((self.x * xstep)) / xstep) + padding), ((round((self.y * ystep)) / ystep) + padding), ((round((self.w * xstep)) / xstep) - (2 * padding)), ((round((self.h * ystep)) / ystep) - (2 * padding)))

dataset/ETHPy150Open glue-viz/glue/glue/core/layout.py Rectangle.snap/original