필터 지우기
필터 지우기

Painter's export problem

조회 수: 8 (최근 30일)
Phil Dixon
Phil Dixon 2015년 1월 21일
편집: Walter Roberson 2018년 5월 13일
Dear Matlab central users,
I have created the following patch object:
Faces =[1 2 3 4; 5 6 7 8;9 10 11 12;13 14 15 16];
Verts = [-1 1;0 1;0 2;-1 2;0 1;1 1;1 2;0 2;1 1;2 1;2 2;1 2;2 1;3 1;3 2;2 2];
AV_color = [ 1 1 1;0 0.05 1;0.5 0.05 1;1 1 1];
figure
pch = patch('Faces',Faces,'Vertices',Verts,'FaceColor','flat','FaceVertexCData',AV_color,...
'EdgeAlpha',0,'FaceAlpha',1);
rgb_colors = get(pch,'CData');
[i,map] = rgb2ind(rgb_colors,64);
set(pch,'CData',double(i));
colormap(map);
Unfortunately, black edges appear around each figure upon painters rendering:
set(gcf, 'Renderer', 'painters');
I need the edges to be the same color as the faces. How can this be done?
Thanks,
Phil

채택된 답변

Chad Greene
Chad Greene 2015년 1월 21일
Painters does not support transparency. Can you set 'LineStyle' to 'none'?
  댓글 수: 3
Mike Garrity
Mike Garrity 2015년 1월 21일
Painters does support transparency as of MATLAB version R2014b. Except for the case of exporting to Postscript or EPS because those formats don't support it.
But as Chad said, if you're only using alpha of 0 or 1, then you might be better off using LineStyle=none. I would expect the graphics system to recognize that they're the same, but the LineStyle approach is a bit simpler.
Phil Dixon
Phil Dixon 2015년 1월 25일
Yes, Chad's simple solution worked!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Francesco Carpanese
Francesco Carpanese 2018년 5월 13일
A possible solution to fake transparency in .eps file is to properly stack the plots you would like to display, being careful to have the patch in the bottom.
plot([0,1], [0,1])
h = patch([0. 1. 1. 0.], [max(ylim) max(ylim) 0 0] , 'y', 'Linestyle', 'none', 'EdgeColor', 'none', 'Facecolor', 'g', 'FaceAlpha', 0.2);
% This is needed to bring patch to the buttom and fake the alpha.
uistack(h, 'bottom')
% Need to specify '-painters'
print('file_test','-painters','-depsc2')
% code
ends

카테고리

Help CenterFile Exchange에서 Polygons에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by