【问题标题】:Saving image as eps将图像另存为 eps
【发布时间】:2015-10-17 13:10:16
【问题描述】:

我正在尝试使用 hist3 使用以下简单代码在 MATLAB 2015a 中创建二维直方图:

figure
hist3([X,Y],[100 100]);
set(get(gca,'child'),'Facecolor','interp','CDataMode','auto');
colormap('jet')
set(gca,'TickLabelInterpreter','latex')
axis 'square'
xlabel('$x$','interpreter','latex','Fontsize',12)
ylabel('$y$','interpreter','latex','Fontsize',12)
view(-37,26)

其中 X,Y 是两个带有length(X)=length(Y)=2026486 的向量。 我尝试使用

将图像保存在 eps
print('example','-depsc')

但生成的图像是基于像素的。我尝试更改渲染器:

print('example','-depsc','-painters')

但 MATLAB 在打印时不断崩溃,所以我必须手动重新启动计算机。 我也尝试以 pdf 格式保存,但质量没有改变。 有没有办法解决这个问题?

【问题讨论】:

    标签: matlab eps


    【解决方案1】:

    尝试使用:

    fig_fname = 'example';
    print(gcf,'-depsc2',[fig_fname '.eps']);
    

    【讨论】:

    • 首先感谢您的回复;我尝试按照您的建议更改代码,但我仍然得到一个基于像素的图像..
    • 尝试找出根本原因:注释掉 view() 看看会发生什么。并将 hist3() 更改为 scatter3(1:10, 1:10, 1:10) 并检查。
    • 使用 scatter3 而不是 hist3 (有和没有 view() )我得到了我想要的矢量化图像;注释掉 view() 并使用 hist3 我获得了一个基于像素的图像..我也尝试改变两个向量 X,Y 的长度但结果是一样的.. 似乎问题在于使用 hist3函数..
    • 我遇到了以下工具。看看吧,它可能会解决你的问题:mathworks.com/matlabcentral/fileexchange/23629-export-fig
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-18
    • 1970-01-01
    相关资源
    最近更新 更多