Improved surface rendering of scatter points

I want to render 4 scattered data vectors with surface plot. The 3 vectors must be coordinates. In addition, the 4th vector should represent the surface color. My first approach was to plot this data (xk, yk, zk, ck) using

scatHand = scatter3(xk,yk,zk,'*');    
set(scatHand, 'CData', ck);   
caxis([min(ck), max(ck)])

      

As a result, I get scattered dots of different colors. Since these points lie on the surface of the hemisphere, you can get colored faces instead of points. I am replacing the scattered points with a surface using griddata to plot the approximation first

xk2=sort(unique(xk));   
yk2=sort(unique(yk));   
[xxk, yyk]=meshgrid(xk2, yk2);   
zzk=griddata(xk,yk,zk,xxk,yyk,'cubic');  
cck=griddata(xk,yk,clr,xxk,yyk,'cubic');     
surf(xxk,yyk,zzk,cck);  
shading flat;

      

This is almost what I want, except that the lower part of the hemisphere is cut off. Of course, if I increase the interpolation point numbers, it gets better, but the graph processing is slow. So I'm wondering if there is an easy way to get the interpolation function to make a clear break. In addition, the dangling boundary appears to be due to the fact that the zzk value gets "NaN" outside the circle that the hemisphere shares with the z = 0 plane. Hemisphere surface built out of scattered data

The red dots at the top are the first few records of the original scattered data.

+3


source to share


1 answer


You can set the parameter ZLim

to cut the plotted values ​​in a certain range.

set(gca, 'Zlim', [min_value max_value])

      



enter image description here

+2


source







All Articles