If you want to either use interpolated shading or change colors using a color map, then you want to build your data in a grid and set the edgecolor property edgecolor . Please note that in order to build it as a grid, you need to duplicate it so that it has a size of at least 2 in each direction.
h = mesh([X(:) X(:)], [Y(:) Y(:)], [Z(:) Z(:)], [C(:) C(:)], ... 'EdgeColor', 'interp', 'FaceColor', 'none');
You can also see the MeshStyle property if you want to build multiple lines at once.
This solution is much better than the one used in cline , because it creates only one graphic object, not n .
Nzbuu source share