补丁透明性问题(FaceAlpha) [英] Problem with patch transparency (FaceAlpha)
问题描述
我在使用Windows XP的Matlab 2010b中进行补丁绘图时遇到了一些奇怪的问题.
当我尝试绘制以下补丁时,我得到的补丁不是全部填充,但有一些空白部分.
I encountered some strange problem with patch ploting in Matlab 2010b with windows xp.
When I try to plot following patch, I get a patch which is not all-filled, but has some blank parts.
如果我将渲染器设置为"painters"(请参见下文),可以解决此问题,
但是我不能更改补丁的透明度.
有人遇到过类似的问题吗?任何解决方法?
This can be solve if I set the renderer to 'painters' (see below),
but then I can't change the transparency of the patch.
Has anyone encountered similar problem before? any workaround?
x = [734608.791666667;734608.843750000;734609;734609.041666667;734609.086805556;734609.125000000;734609.250000000;734609.277777778;];
y = [85.7847149493030;95.4499999983124;96.4800000077516;112.549999984098;109.949999996456;118.299999970804;120.450000002981;112.600000008944;];
figure;
set(gcf, 'Renderer', 'opengl');
patch(x, y, 'r');
title('this plot is with wrong vertices positions');
figure;
set(gcf, 'Renderer', 'painters');
patch(x, y, 'r', 'FaceAlpha', 0.1);
title('this plot is OK, but renderer ignores the transparency');
figure;
set(gcf, 'Renderer', 'opengl');
patch(x, y, 'r', 'FaceAlpha', 0.1);
title('this plot is with wrong vertices positions, but with transparency');
推荐答案
问题似乎源自于MATLAB-> OpenGL渲染管道(我的猜测)中某个地方的浮点精度.
The problem seems to originate from the floating point accuracy somewhere the MATLAB -> OpenGL rendering pipeline (my guess).
如果您将x操纵为:
x = [734608.791666667;734608.843750000;734609;734609.041666667;734609.086805556;734609.125000000;734609.250000000;734609.277777778;];
x = (x - mean(x));
这些图似乎工作正常.
这篇关于补丁透明性问题(FaceAlpha)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!