【发布时间】:2015-08-04 06:55:23
【问题描述】:
在 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.
为什么以及如何使用 ZData 影响其他对象?为什么他们不一起工作?怎么了?谢谢!!
之后:
【问题讨论】:
-
这是渲染器的问题。您对矢量渲染器画家好吗? ->
set(gcf,'Renderer','painters')。除此之外,您还想对二维图中的 Z 数据做什么?您能否发布一张屏幕截图,说明它的外观以及您想要更改的内容? -
HI @thewaywewalk 添加了屏幕截图
-
好的,所以它在我的机器上看起来和我的机器上一样,特别让我想知道的是,蓝色补丁出现在前面。这是不希望的,是吗?那么
painters的方式呢,你试过了吗? -
看来ZData之后的那行代码解决了问题-
set(gca,'SortMethod','childorder') -
这是一个我以前从未使用过的有趣属性。您应该将其发布为答案。
标签: matlab matlab-figure