在linux中使用matlab 2015a。 尝试此代码(使用切片网格,附加mat文件中的x和y) FaveAlpha.mat
load('FaceAlpha.mat'); % Loading SliceGrid and X,Y parametrs
hold on; xlabel('X'), ylabel('Y'), zlabel('Z'); axis equal;
axis image;
plot(SliceGrid.x(X),SliceGrid.y(Y),'blue.');hold on;
h=[-8 -0.5 0.5 1]
v=[7 4 4 7];
fill_2=fill(h,v,'blue'); % Creating blue object
x=[0 -0.5 0.5 1]
y=[9 4 4 9];
fill_1=fill(x,y,'red');% Creating red object
t=[-2 -0.5 0.5 2];
z=[9 2 2 0];
fill_3=fill(t,z,'yellow'); % Creating yellow object
set(fill_1,'FaceAlpha',0.5); % After this line everthing is ok.
set(fill_2, 'ZData', repmat(10, size(get(fill_2, 'XData')))); % After this line the outside blue plot is damaged - as you can see in the above figure
%%%%%%%%%%%% if we omit the line -> set(fill_1,'FaceAlpha',0.5);
%%%%%%%%%%%% and leave the code with the ZData property, the outside blue plot doesn't damaged.
%%%%%%%%%%%% if we omit the line -> set(fill_2, 'ZData', repmat(10, size(get(fill_2, 'XData'))));
%%%%%%%%%%%% and leave the code with the FaceAlpha property, the outside blue plot doesn't damaged.
面部alpha为什么以及如何使用ZData影响其他对象?为什么他们不能一起工作?怎么了?谢谢!!
后:
答案 0 :(得分:0)
好的,所以看来如果我们检查这行代码之后的代码:
set(fill_1,'FaceAlpha',0.5);
a=get(gca,'SortMethod')
我们将获得一个= childorder,这意味着每个对象的外观都是由图的gca的子顺序(这是默认的方式) 在ZData的代码行之后,该顺序由Matlab改变,它改为深度,所以如果你将重新使用该函数:
a=get(gca,'SortMethod')
a =现在深度。
因此,如果您想解决问题,请使用以下代码:
set(gca,'SortMethod','childorder')
而且 - 我们有一个胜利者! :)