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 Center および File ExchangePolygons についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by