Just plot each line segment using line, where you define the end points of the segments. You can provide a color spec for each segment as you wish.
As far as changing from red to blue, What is red in terms of RGB? [it is [1 0 0]. What is blue? it is [0 0 1]. You can choose a value between the two end points simply enough, as
Cfun = @(t) Cred*t + Cblue*(1-t);
You might want to change that mapping to decide what happens in the interior of the path through color space, but that should suffice. For example, should the mid level go through a mid level gray? Or should it be a vaguely purplish color?
So for any intermediate color based on the parameter t, we would see
In your code, you will simply need to transform the stresses you find, something like this:
t = (stress - min(stress))./(max(stress) - min(stress));
The maximum stress will now map to red, the min stress will map to blue.