Why does one z axis side remains invisible even when all axes are on and box is on?
2 views (last 30 days)
Show older comments
I have a surface plot where all axes are on and box is set to on, but one side of the z-axis remains invisible. The single z-axis side remains invisible even when I export the figure to eps or pdf. I've already come across this post: http://au.mathworks.com/matlabcentral/answers/38530-surf-z-axis-not-visible but the proposed solutions did not fix my problem. I have even tried placing "hold on" in the for-loop, after the call to surf, but this still did not fix the issue. Any suggestions for recovering the missing edge of the z-axis are greatly appreciated!
My code:
col_map = [1 0 0;0 1 0;0 0 1;1 1 0;1 0 1;0 1 1];
cdex = randi(6,100,1);
[x1,y1,z1] = sphere(40);
scale = 0.02;
x1 = scale * x1; y1 = scale * y1; z1 = scale * z1;
figure('Position',[0 0 700 700]);
set(gca,'Color',[0.75 0.75 0.75]);
set(gca,'XTick',[]); set(gca,'YTick',[]); set(gca,'ZTick',[]);
set(gca,'ZColor','k');
x = rand(100,1); y = rand(100,1); z = rand(100,1);
hold on
for j = 1:length(x)
surf(x(j) + x1,y(j) + y1,z(j) + z1,'FaceColor',...
col_map(cdex(j),:),'EdgeColor','none')
end
light('Position',[1 1 0],'Style','infinite'); hold on
axis([-0.05 1.05 -0.05 1.05 -0.05 1.05]);
set(gca,'Xdir','reverse');
view(3)
view(70,30)
box on
6 Comments
Answers (0)
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!