Patch does not fill area

19 Ansichten (letzte 30 Tage)
Fredrik Walka
Fredrik Walka am 12 Dez. 2022
Beantwortet: Fredrik Walka am 16 Dez. 2022
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 Kommentare
Fredrik Walka
Fredrik Walka am 12 Dez. 2022
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 am 13 Dez. 2022
Bearbeitet: Voss am 13 Dez. 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')

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Vinayak Choyyan
Vinayak Choyyan am 16 Dez. 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.

Fredrik Walka
Fredrik Walka am 16 Dez. 2022
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.

Tags

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by