updated code to produce energy distance plot