필터 지우기
필터 지우기

painters renderer ignoring uistack and z values in R2014b

조회 수: 1 (최근 30일)
Chad Greene
Chad Greene 2015년 11월 19일
댓글: Chad Greene 2015년 11월 19일
I'm writing a script that will be used on R2012b and R2014b. It works wonderfully in R2012b, but R2014b is ignoring z values and ignoring uistack order. Oddly enough, the problem only arises when I give any of the objects a z value. Here is an example:
figure('renderer','painters')
h0 = imagesc(peaks(100));
hold on
[C,h1] = contour(peaks(100),'color',.4*[1 1 1]);
clabel(C,h1);
h2 = plot(1:100,1:100,'b-','linewidth',3);
h3 = plot(1:100,(1:100).^1.2-30,'r','linewidth',3);
h4 = text(30,50,'some text near the top','color',[.98 .45 .02]);
h5 = text(25,75,1,'this text should be on top of everything');
Using uistack(h5,'top') does not fix the problem.
I don't understand why, but if I set the z value in h5 to 0, the problem goes away. Does anyone know why this is happening or how I can work around it? I need to stick with the painters renderer.

채택된 답변

Mike Garrity
Mike Garrity 2015년 11월 19일
편집: Mike Garrity 2015년 11월 19일
You need to learn about the SortMethod property on the axes. I talked about it in this post on the MATLAB Graphics blog. Because you put one text object at a different Z value from the rest of the scene, the axes guessed that you probably wanted depthsort. It sounds like you actually want childorder.
  댓글 수: 1
Chad Greene
Chad Greene 2015년 11월 19일
That's it! The fix really is as easy as
ax = gca;
ax.SortMethod = 'childorder';
Thanks Mike!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by