乳胶解释器+在MATLAB中放大字体大小在图中降低文本分辨率

时间:2015-01-22 17:25:52

标签: matlab latex matlab-figure

我在绘图时一直使用shadedErrorBar,而我使用shadedErrorBar后的部分代码如下:

plot1 = shadedErrorBar(tau_vec, mean(deg_20_hubs_0), sd_deg_20_hubs_0, 'b-o', 1);   hold on;
plot2 = shadedErrorBar(tau_vec, mean(deg_20_hubs_1), sd_deg_20_hubs_1, 'r-o', 1);
plot3 = shadedErrorBar(tau_vec, mean(deg_40_hubs_0), sd_deg_40_hubs_0, 'b-x', 1);
plot4 = shadedErrorBar(tau_vec, mean(deg_40_hubs_1), sd_deg_40_hubs_1, 'r-x', 1);
hold off;
set(gca, 'FontSize', 15);
xlabel('$\log_2 C_\tau$', 'Interpreter', 'latex'); ylabel('ExNVI');
xlim([-13, 13]);
ylim([0, 1]);

I=legend('$\bar{d}=20$; no hub   ', '$\bar{d}=20$; with_hubs   ', '$\bar{d}=40$; no hub   ', '$\bar{d}=40$; with hubs   ', ...
'Location', 'SouthWest');
set(I, 'Interpreter', 'latex', 'fontsize', 15);

if(off_diag==10 && N==500)
    set(I, 'visible', 'on');
else
    set(I, 'visible', 'off');
end

box on;
set(gca,'units','centimeters');
pos = get(gca,'Position');
ti = get(gca,'TightInset');

set(gcf, 'PaperUnits','centimeters');
set(gcf, 'PaperSize', [pos(3)+ti(1)+ti(3)+0.6 pos(4)+ti(2)+ti(4)+0.6]);
set(gcf, 'PaperPositionMode', 'manual');
set(gcf, 'PaperPosition',[0 0 pos(3)+ti(1)+ti(3)+0.6 pos(4)+ti(2)+ti(4)+0.6]);

saveas(fig, sprintf('./output/offdiag_%d_N_%d.pdf', off_diag, N));

结果图的分辨率低的文字如下:

enter image description here 但曲线的分辨率很好。当我尝试删除乳胶解释器时,问题消失了,但是有可能保留它并修复分辨率吗?我在Windows下的MATLAB 2014b下完成了这个情节。

非常感谢!

1 个答案:

答案 0 :(得分:1)

set(gcf, 'renderer','painters');

将解决问题。它将图形渲染为矢量图形,这是更好的选择,因为您使用的是pdf格式。同时使用print命令而不是saveas指定分辨率:

print(fig, '-dpdf', '-r600', 'myFigure.pdf')