Plotting function is now working