Why do certain line markers show up faded when saving high resolution images using print?
Mostra commenti meno recenti
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');
Risposte (1)
Jan
il 29 Giu 2017
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
Categorie
Scopri di più su Annotations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!