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.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', 'o开发者_JAVA技巧pengl');
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');
The problem seems to originate from the floating point accuracy somewhere the MATLAB -> OpenGL rendering pipeline (my guess).
If you manipulate x to:
x = [734608.791666667;734608.843750000;734609;734609.041666667;734609.086805556;734609.125000000;734609.250000000;734609.277777778;];
x = (x - mean(x));
The plots seem to work fine.
精彩评论