Modified distance plot to use lattice