Instead of using plot3() you can use
r = sqrt(x.^2 + y.^2 + z.^2);
g = patch('Vertices', [x(:), y(:),z(:); nan nan nan], 'Faces', (1:length(x)+1).', 'FaceVertexCData', [r(:); nan], 'EdgeColor', 'interp', 'Marker','*')
This will shade both the lines and the markers.
There is a "trick" here, which is to put in the nan as a face. If you do not put in the nan (or inf instead) then patch() will close the polygon.
