Use ColorFunction
instead of PlotStyle
.
I haven't tried to reverse engineer your code to make sure this produces your desired result, and some of your code seems suspicious (like the FindMinimum
/FindMaximum
stuff), but ColorFunction
is the option to use to color the plot according to the coordinates of points on the plot.