added function that plots lines between nearest of same category