Patch does not fill area
19 views (last 30 days)
Show older comments
Hi,
I have an issue with filling a patch area with selected face color. This works as intended in Matlab 2014a, but not in Matlab 2021a for unknown reason. It usethe same data for xPlot, yPlot and zPlot, but still fails in Matlab 2021a.
patch(xPlot,yPlot,zPlot,'g','FaceAlpha',0.2,'Parent',appData.handles.mainax);
Is there a change in patch behaviour I have missed? My other functions creating patched areas are working, it is only this kind of case that is affected.
I have included images for the visual differences. The second image for 2021a is another plot, which has the same issue. It also works in 2014a.
Br
Fredrik Walka
3 Comments
Voss
on 13 Dec 2022
Edited: Voss
on 13 Dec 2022
Does the patch look filled if you remove the transparency (i.e., remove 'FaceAlpha',0.2, or use 'FaceAlpha',1)?
Another thing: I notice you are using zPlot; does that mean your patch has some non-zero ZData? That is to say, is it a patch in 3 dimensions? Maybe some other object is obscuring it in the Z-direction? Try using the rotate3d tool or setting the axes View to some 3d view and see if the patch changes.
Also, what happens if you change the figure Renderer? E.g., try each of the following separately:
set(gcf,'Renderer','opengl')
set(gcf,'Renderer','painters')
Answers (2)
Vinayak Choyyan
on 16 Dec 2022
Hi Fredrik
A patch is made up of very tiny quadrilaterals. Before 16b, when patch function is used to plot a set of data in 3D mode, the faces parallel to the Z-axis become invisible. Only the faces perpendicular to the Z-axis are visible. There was a check to remove very small quad polygons (that are too small to see)
The problem here is that parts of the scene were made up of very small quads, and the total of those things will be visible, even if individual quads will not.
As a workaround, consider removing the Z-axis coordinates from the input as it looks like your data is 2D.
0 Comments
See Also
Categories
Find more on Polygons 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!