@on_trait_change('[x, y, z]')
    def _xyz_changed(self):
        x, y, z = self.x, self.y, self.z
        dx = x[1, 0, 0] - x[0, 0, 0]
        dy = y[0, 1, 0] - y[0, 0, 0]
        dz = z[0, 0, 1] - z[0, 0, 0]
        ds = self.dataset
        ds.origin = [x.min(), y.min(), z.min()]
        ds.spacing = [dx, dy, dz]
        if self.m_data is not None:
            self.m_data.set(origin=ds.origin, spacing=ds.spacing)
        self.update()
dataset/ETHPy150Open enthought/mayavi/mayavi/tools/sources.py/MArraySource._xyz_changed/original