How do you fix this polygon glitch generated by fill3?
2 views (last 30 days)
Show older comments
In the pictures below you can see blue rectangles plotted using fill3. You can see that when the data is plotted as part of the main figure a glitch appears where the rectangle appears to enter itself. When this data (attached at XYZ.mat) is plotted on its own using fill3 it does not glitch (second picture).
Could anyone explain why this is happening and either how to fix it, or a different technique I could use to produce the correct result?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150780/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150781/image.jpeg)
Sample data
X =[
1.7566 , 1.7559, 1.7552, 1.7543 , 1.7538, 1.7531, 1.7523, 1.7532;
1.7775 , 1.7768 , 1.7328 , 1.7758 , 1.7752 , 1.7307 , 1.7743 , 1.7754;
1.7768 ,1.7328 , 1.7758 , 1.7752 , 1.7307 , 1.7743 , 1.7754 , 1.7349;
1.7559, 1.7552 , 1.7543 , 1.7538 ,1.7531 , 1.7523 , 1.7532 , 1.7567]
Y =[
4.4285 , 4.4278, 4.4275, 4.4270, 4.4267, 4.4261, 4.4258, 4.4265;
4.4148 , 4.4142 , 4.4164 , 4.4143 , 4.4139 , 4.4150 , 4.4139 , 4.4150;
4.4142 , 4.4164 , 4.4143 , 4.4139 , 4.4150 , 4.4139 , 4.4150 , 4.4170;
4.4278 , 4.4275 , 4.4270 , 4.4267 , 4.4261 , 4.4258 , 4.4265 , 4.4285]
Z =[
0, 0.0278, 0.0552, 0.1000, 0.1267, 0.1531, 0.2000, 0.2265;
0.0001 , 0.0281 , 0.0546 , 0.1003 , 0.1270 , 0.1523 , 0.2000 , 0.2255;
0.0281 , 0.0546 , 0.1003 , 0.1270 , 0.1523 , 0.2000 , 0.2255 , 0.2609;
0.0278 , 0.0552 , 0.1000 , 0.1267 , 0.1531 , 0.2000 , 0.2265 , 0.2567]
fill3(X,Y,Z,'b')
Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!