Patch does not fill area

18 次查看(过去 30 天)
Fredrik Walka
Fredrik Walka 2022-12-12
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 个评论
Fredrik Walka
Fredrik Walka 2022-12-12
Hi,
Adding 'FaceColor','green' does not change anything. Removing 'g' makes the edge lines go away too. Regardless the area is not filled.
Voss
Voss 2022-12-13
编辑:Voss 2022-12-13
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')

请先登录,再进行评论。

回答(2 个)

Vinayak Choyyan
Vinayak Choyyan 2022-12-16
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.

Fredrik Walka
Fredrik Walka 2022-12-16
Hi,
I found a solution in the thread https://se.mathworks.com/matlabcentral/answers/161499-blank-areas-with-fill-and-patch-in-2014b, and have adjusted some zPlot values with a fraction and the areas are now being colored as they should. The plot area is used for both 2D and 3D, a decision by the original developer, which I have to relate to.
Thanks for your input in this. Even though I'll go for this solution, your proposed solutions may very well be needed if new issues arise.

类别

Help CenterFile Exchange 中查找有关 Polygons 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by