필터 지우기
필터 지우기

Patch does not fill area

조회 수: 24 (최근 30일)
Fredrik Walka
Fredrik Walka 2022년 12월 12일
답변: Fredrik Walka 2022년 12월 16일
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