Poor resolution on EPS caused by fill function
5 ビュー (過去 30 日間)
古いコメントを表示
I have a problem with the resolution from matlab figures saved as EPS and used in a latex document.
Figures on pdf have poor resolution. It happens when function fill is added. Example code:
a = [7 7 7 3 3 3];
b = [5 6 7 5 4 3];
x = [1:1:6];
xticks(1:1:6)
axis([1 6 2 8])
hold on;
stairs(x,b,'--r')
plot(x,a,'m')
% When using fill the resolution goes from good to poor
fill([2 2 4 4],[2 8 8 2],'r','FaceAlpha',.1,'EdgeAlpha',0)
This code will make a eps figure look like this on the pdf:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/622408/image.png)
I need transparency on the fill color, but setting FaceAlpha to 1 makes no difference:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/622413/image.png)
Without fill - resolution is good:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/622418/image.png)
What can I do to get good resolution? (I need to have color with adjustable transparency, or at least see the lines on top of a color which is not so intense.)
0 件のコメント
回答 (1 件)
Bjorn Gustavsson
2021 年 5 月 19 日
As far as I understand post-script does not really support transparency. Therefore when writing figures with transparent objects the printing will be done as a bit-mapped image and not in neatly vectorized format. You might get good enough output if you print to a .png-image with high enough resolution (image might become impolitely big):
print('-dpng','-r600','yourfilename.png')
You might also get some neater lables and such using ps-tricks (if this is still a tool in use in latex, I've been fortunate enough to never need to use it...).
HTH
2 件のコメント
Bjorn Gustavsson
2021 年 5 月 20 日
For this objective the "simplest" solution is just to crank up the resolution (or wait till the post-script format starts to handle transparency). I know this is a terribly unsatisfactory suggestion. Maybe you can somehow fudge things by printing the transparency object into an image-file (without labels and tick-marks, just the transparent surfaces) then load that image and display it using imagesc/imshow and manually set tick-marks and labels (and possibly add lines) and write that to an eps-file. That ought to give you the line-objects and text in vectorized format - admittedly this requires lots of manual editing and fidgeting...
参考
カテゴリ
Help Center および File Exchange で Lighting, Transparency, and Shading についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!