2015-10-17 54 views
0

我试图用hist3使用简单下面的代码创建在MATLAB 2015A二维直方图:图像保存为EPS

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两个向量。 我尝试使用

print('example','-depsc') 

在EPS保存图像,但所得到的图像是基于像素的。我试着改变渲染器:

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

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

回答

0

尝试使用:

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

首先,感谢您的回复;我尝试改变代码,因为你建议,但我仍然得到一个基于像素的图像。 –

+0

尝试根源导致它:注释视图(),看看会发生什么。然后将hist3()更改为scatter3(1:10,1:10,1:10)并检查。 – yuval

+0

使用scatter3而不是hist3(有和没有view())我得到矢量化的图像,我想;注释视图()和使用hist3我得到一个基于像素的图像..我也试着改变两个向量X,Y的长度,但结果是一样的.. 看来,问题在于使用hist3函数.. –