You are plotting the graph between voltage and some other value and I see you are not plotting with time. In this case its confusing. For a solution you can remove the slope function and just find the difference between the point x and x-1 at regular intervals and wire it to the right side of the for loop so finally you will get the slew rates between each points. For achieving the x-1 you can have a shift register and on the left side pull the shift register down and take that value and subract.
The best solution is the one you find it by yourself