Hi,
I am having trouble in saving a figure in epsc2 format. Looks like matlab cuts out part of the figure while saving the figure. Below is the code I am suing where I set figure size in inches and set the renderer to painters. Sometimes matlab saves the whole figure as intended but most of the time it cuts out a significant part of the figure. I use matlab on ubuntu m/c with nvidia driver. Below is the code I am using,
LineStyles = {'-c', '--m','-.r',':g','-+b','-oc','-s','-d','-^','-*'}; % 10 types total
LineStyles1 = {'oc', 'om','or','og','ob','oc','om','-d','-^','-*'}; % 10 types total
figWidth = 3; figheight = figWidth/1; formatEng = '-depsc2';
set(groot,'defaultFigurePaperPositionMode','manual');
figure(); set(gcf,'Renderer','painters');
set(gcf, 'PaperUnits', 'inches', 'PaperPosition', [0 0 figWidth figheight]);
hold all;
counter = 0;
for kk = 1:2:length(heightVec)
counter = counter + 1;
plot(kx_fourier.*z_vec(heightVec(kk))/z_i, fourier_spectra_u_frame(kk,:).*kx_fourier./ustar^2, LineStyles{counter});
plot(kwave.*z_vec(heightVec(kk))/z_i, wavelet_spectra_u_frame(kk,:).*kwave./ustar^2,LineStyles1{counter});
end
xlabel('$k_x z$','Interpreter','Latex','FontSize',10);
ylabel('$k_x E_{11}(k_x)u_*^{-2}$','Interpreter','Latex','FontSize',10);
%xlim([0.05 50]);
%ylim([8e-9 0.00004]);
xx = [0.3 19];
loglog(xx,xx.^(-2/3).*1,'LineWidth',2); % -2/3 slope
text(5, 0.45, '-2/3','FontSize',8);
set(gca,'XScale','log'); set(gca,'YScale','log');
SPR = sprintf('%s','wavelet_n_fourier_spectra_ek02_pre.eps');
set(gcf, 'Color', 'w');
print(SPR, formatEng);
Can you please suggest me a way to solve the problem. I tried to find a solution online but did not find a solution.
Attached is the output I get.