Changed the implementation to plot correctly with XY cords