Why does changing certain parameters while invoking 'plot3' function reduce the smoothness of the plotted curve?
Show older comments
I was trying to use 'plot3' function to plot a 3-dimensional curve. Changing some of the parameters in the function call creates the issue of smoothness loss in the curve plotted. One of the cases wherein this is observed is while setting 'alpha' of a patch to transparency.
The following code snippet creates two subplots where the first subplot appears to be smooth, whereas the second one is not.
topx = [0 0.1415 -0.1415];
topy = [-0.1640 0.0815 0.0815];
kns = [0 0.5958 -0.5958; -0.6880 0.3440 0.3440; 0 0 0];
pfmx = [0 0.1 -0.1];
pfmy = [0 0.1 -0.2];
pfmz = -0.1;
basex = [-0.2829 0.2829 0]
basey = [ -0.1640 -0.1640 0.3270]
figure,
subplot(121)
hold on, grid on
f.base = patch(basex,basey,[.4 .4 .4]);
% f.base.FaceAlpha = 0.75;
f.base.EdgeColor = 'none';
view(3)
f.legs = plot3([topx(1),kns(1,1),pfmx(1)],[topy(1),kns(2,1),pfmy(1)],[0,kns(3,1),pfmz],'b-',...
[topx(2),kns(1,2),pfmx(2)],[topy(2),kns(2,2),pfmy(2)],[0,kns(3,2),pfmz],'b-',...
[topx(3),kns(1,3),pfmx(3)],[topy(3),kns(2,3),pfmy(3)],[0,kns(3,3),pfmz],'b-','linewidth',3);
subplot(122)
hold on, grid on
f.base = patch(basex,basey,[.4 .4 .4]);
f.base.FaceAlpha = 0.5;
f.base.EdgeColor = 'none';
view(3)
f.legs2 = plot3([topx(1),kns(1,1),pfmx(1)],[topy(1),kns(2,1),pfmy(1)],[0,kns(3,1),pfmz],'b-',...
[topx(2),kns(1,2),pfmx(2)],[topy(2),kns(2,2),pfmy(2)],[0,kns(3,2),pfmz],'b-',...
[topx(3),kns(1,3),pfmx(3)],[topy(3),kns(2,3),pfmy(3)],[0,kns(3,3),pfmz],'b-','linewidth',3);
Why is this behavior observed? Is this a bug?
Accepted Answer
More Answers (0)
Categories
Find more on Lighting, Transparency, and Shading 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!