フィルターのクリア

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 Center および File ExchangeGraphics Object Properties についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by