I followed a previous reply trying to reduce the number of lines on a 3D plot but it does not seem to work in my case. What is happening in my case is that it does not show any lines at all. I am not sure what am I doing wrong. Could you please help me?
The code that I am using is below, where PWNORM,PSNORM,DOS are the three vectors with data that define each point of my surface:
figure
surfc(PWNORM,PSNORM,DOS)
hidden on
colormap(flipud(colormap))
caxis([20,70])
ylim([0 4])
xlim([0.5 5.5])
zlim([20 70])
s=surfc(PWNORM,PSNORM,DOS,'EdgeColor','none')
caxis([20,70])
ylim([0 4])
xlim([0.5 5.5])
zlim([20 70])
xlabel('W ');
ylabel('S');
zlabel('SD');
x=get(s,'XData');
y=get(s,'YData');
z=get(s,'ZData');
x=x(1,:);
y=y(:,1);
xnumlines = 50;
ynumlines = 50;
xspacing = round(length(x)/xnumlines);
yspacing = round(length(y)/ynumlines);
hold on
for i = 1:yspacing:length(y)
Y1 = y(i)*ones(size(x));
Z1 = z(i,:);
plot3(x,Y1,Z1,'-k');
end
for i = 1:xspacing:length(x)
X2 = x(i)*ones(size(y));
Z2 = z(:,i);
plot3(X2,y,Z2,'-k');
end
hold off