2013-02-15 37 views
1

Matlab图形中的虚线/虚线在图形窗口中看起来有些不错,但打印时,它们松散分辨率,看起来非常糟糕。见下图。我怎样才能使虚线/虚线看起来完全像在屏幕上?如何在轮廓图中使虚线/虚线看起来逼真 - Matlab

感谢,

enter image description here

+1

我总是将数据导出为.eps文件,它们在乳胶文档中工作良好,打印时看起来很棒。 – johnish 2013-02-15 20:35:59

回答

1

我会使用Loren在她的优秀帖子making pretty graphs上建议的方法。它使用她编写的函数进入输出eps文件,并调整虚线的定义。在FEX上找到fixPSlinestyle

figure('renderer','painters') 
hold on 
plot([1 2 4],[2 3 7],'r-','linewidth',13) 
plot([1 2 4],[2.5 3.5 7.5],'b:','linewidth',13) 

print(gcf,'-depsc2','withoutedit.eps') 
fixPSlinestyle('withoutedit.eps','withedit.eps') 

第一个图(withoutedit.eps)显示在左侧和右侧示出了EPS线型已被调整了后(withedit.eps):

enter image description here

我喜欢这个解决方案,因为你没有把完整的控制权交给一个函数 - 你控制着图的输出(通过print命令),但是你使用了一个函数来调整最终的eps文件。

1

尝试使用export_fig从FEX,应该解决这个问题。

+1

谢谢,但应该有一些在Matlab中的东西呢? – 2013-02-15 19:38:32

2

我遇到了这个问题,并在另一个论坛上找到了解决方案。有几个选项。如果您不介意导出到位图,则可以使用其他渲染器(OpenGL或zbuffer),但对我而言,这不是一个可接受的解决方案。相反,您可以提取轮廓信息并代之以绘制虚线。我欠这个解决方案的原始海报,但不记得我在哪里得到它。

[c1,h1] = contour(data, Contours,'--k') 

% Take all the info from the contourline output argument: 
i0 = 1; 
i2 = 1;  
while i0 < length(c1) 
    i1 = i0+[1:c1(2,i0)]; 
    zLevel(i2) = c1(1,i0); 
    hold on 
    % And plot it with dashed lines: 
    ph(i2) = plot(c1(1,i1),c1(2,i1),'k--','linewidth',.5); 
    i0 = i1(end)+1; 
    i2 = i2+1; 
end 
% Scrap the contourlines: 
delete(h1) 

希望有帮助! -D

+0

非常感谢... – 2013-05-30 11:01:14

相关问题