matlab - 用点划线和虚线绘制问题 : How to modify default linestyles for better use with vector renderer 'painters' ?

标签 matlab plot matlab-figure renderer

Matlab 提供以下默认值 linestyles :

'-'     Solid line (default)
'--'    Dashed line
':'     Dotted line
'-.'    Dash-dot line

前两个没问题,第三个 : 绝对不是我的口味,渲染得很糟糕,最后一个 -. 只适用于像素渲染器( openGL, zbuffer), 否则看起来和--一样。但出于无数原因,我想用 painters 渲染我的图表。这样,点划线就变得无用了:

enter image description here

点划线(蓝色、亮红色)实际上看起来与虚线(深红色)相同。这是我基于矢量图形的 PDF 的 3000% 缩放。

这基本上是我生成图形的代码:

set(fig_handle, 'Units','centimeters','PaperUnits','centimeters')
set(fig_handle,'Position',[1 1 width height],...
       'PaperPosition',[0 0 width+margin height+margin],...
       'PaperSize',[width+margin height+margin],...
       'PaperPositionMode','auto',...
       'InvertHardcopy', 'on',...
       'Renderer','painters'...     
   );

saveas(fig_handle,name,'pdf')

好吧,我需要第三种线型,您知道创建自定义线型或修改现有线型的可能性吗? 增加破折号和点之间的距离应该已经解决了这个问题。

标记和像素渲染器的使用是不可取的!

还有一些“省略”值的“自定义”行不应该是一个选项。

感谢您的任何建议。

最佳答案

MATLAB 的绘图程序曾经是一流的。它们比竞争对手的要好得多,以至于它们成为许多人购买 MATLAB 的原因。

然而,这已经改变了。与 Mathematica、SciLab 和其他公司的绘图相比,它们现在看起来更像是过去的爆炸。它们看起来不太漂亮,它们在使用不同标准的渲染引擎时存在很多问题,可定制性相当差,即使是简单的更改也可能会产生相当复杂的效果等。

不要误会我的意思,它们仍然很不错,但它们不再是购买该产品的理由。我什至听说一些潜在的新用户决定选择其竞争对手之一,部分原因是基于图形的外观。

MathWorks 当然不止于此。他们的 react 相当慢(我假设他们有一些困难),但我知道他们已经对图形算法和实用程序进行了 4 年多的重大改革。

它叫做 hg2handle graphics v. 2 的缩写。自 2010 年以来,它已经在 MATLAB 中可用,但后来它完全没有文档记录、有缺陷、难以使用等。

然而,这多年来一直在稳步改进,现在它实际上非常有用(虽然仍然不受支持,官方)。 Yair Altman(来自 UndocumentedMatlab.com)写道 a nice in-depth article on the subject .

这具有您需要的功能,然后是一些 :)

编辑: 我刚刚收到一封来自 MATLAB 中心的现任管理员 John Kelly 的电子邮件。前几行:

The R2014b prerelease is now available for download. This version of MATLAB contains many new features including a new graphics system. There are changes in the R2014b graphics system that may affect the operation of existing code. As an author of a popular File Exchange submission, we would like to encourage you to download the R2014b prerelease so that you have an opportunity to make changes to your submission in preparation for the release of R2014b.

所以 R2014b 终于附带了一个官方的 hg2 :)

关于matlab - 用点划线和虚线绘制问题 : How to modify default linestyles for better use with vector renderer 'painters' ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24204762/

相关文章:

r - 如何在ggplot的geom_label中设置标准标签大小?

将马赛克图表示为 TreeMap

matlab - 在事件轮廓法中绘制能量

Matlab ylabel截止使用plotyy函数

matlab - 如何在 Matlab 绘图中遮蔽水平线和曲线之间的区域

MATLAB "SIGMA must be symmetric and positive definite"错误有时没有意义

c++ - 如何在 C++ 中创建这个 yml 文件(使用 opencv)

matlab - 在 Matlab 中向矩阵添加维度

emacs - 如何让 Octave 的情节在 emacs 下运行?

MATLAB:颜色显示不正确?