필터 지우기
필터 지우기

Why do certain line markers show up faded when saving high resolution images using print?

조회 수: 7 (최근 30일)
I am saving MATLAB figures as high resolution .png files to use in a paper. Version is R2016a. The markers for triangles, squares, diamonds, and others show up fine in the MATLAB figure, but are faded when I open the .png file. Circle markers and lines are unaffected. Changing the lineWidth makes then too dark when >1, and does not have an efffect <=1. Chaning to a .tif or.jpeg did not help. I attached the saved picture and a picture I saved manually using the menu in the figure. Here is the original reference: https://dgleich.github.io/hq-matlab-figs/ Here is the code along with some random data. Any help would be appreciated as I could not find anything online. Thank you.
clear
close all
clc
x=linspace(1,10);
y1=linspace(7,7);
y2=linspace(5,5);
y3=linspace(3,3);
y4=linspace(1,1);
hold all
plot(x,y1,'k')
plot(x,y2,'ok','MarkerSize',7)
plot(x,y3,'^k','MarkerSize',7,'LineWidth',0.9)
plot(x,y4,'^k','MarkerSize',7,'LineWidth',1.1)
axis([1, 10, 0, 10]);
width = 6.5; % Width in inches
height = 3.55; % Height in inches
alw = 0.75; % AxesLineWidth
fsz = 11; % Fontsize
lw = 1.5; % LineWidth
msz = 8; % MarkerSize
% Here we preserve the size of the image when we save it.
set(gcf,'InvertHardcopy','on');
set(gcf,'PaperUnits', 'inches');
papersize = get(gcf, 'PaperSize');
left = (papersize(1)- width)/2;
bottom = (papersize(2)- height)/2;
myfiguresize = [left, bottom, width, height];
set(gcf,'PaperPosition', myfiguresize);
pos = get(gcf, 'Position');
set(gcf, 'Position', [pos(1) pos(2) width*100, height*100]); %<- Set size
set(gca, 'FontSize', fsz, 'LineWidth', alw); %<- Set properties
% Save the file as PNG
print('saved_file','-dpng','-r600');

답변 (1개)

Jan
Jan 2017년 6월 29일
Export it as eps:
print(gcf, 'test.ps', '-deps2')
Including this in Word works perfectly - only the preview on the screen looks coarse, but the output to paper or a PDF is nice.
I use GhostScript to convert the EPS to other formats on demand.
For output problems it is worth to give this a trial: https://www.mathworks.com/matlabcentral/fileexchange/23629-export-fig
  댓글 수: 4
Jan
Jan 2017년 6월 29일
I do not observe the problem using 2016b.
It is surprising that the output in Word looks ugly. This is expected only, when the figure renderer is OpenGL. Is this the case for you?
Joshua
Joshua 2017년 6월 29일
I do not see any evidence of OpenGL, but it is a university computer so I am not positive. The pdf does look better than when it is sitting in Word, but everything still looks way to dark like it is bolded. I am using 2016a.
I think I have managed to work around it enough though. Thank you for your help.

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

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by