1

Matlab 图形中的点/虚线在图形窗口中看起来还不错,但是在打印时,它们会失去分辨率并且看起来非常糟糕。见下图。如何使虚线/虚线看起来与屏幕上一模一样?

等高线上带有注释的示例等高线图

4

3 回答 3

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

于 2013-05-22T23:28:55.490 回答
1

尝试使用FEX 中的export_fig,它应该可以解决该问题。

于 2013-02-15T19:36:44.563 回答
1

我会使用 Loren 从她关于制作漂亮图表的优秀帖子中建议的方法。它使用她编写的一个函数,该函数进入输出 eps 文件,并调整虚线的定义。fixPSlinestyleFEX上找到。

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):

在此处输入图像描述

我喜欢这个解决方案,因为您没有将完全控制权交给函数 - 您控制图形的导出(通过print命令),但您使用函数来调整最终的 eps 文件。

于 2013-05-23T01:10:14.770 回答