matlab - 如何将 Matlab 直方图保存为矢量图形?

标签 matlab vector-graphics postscript

像这样保存直方图时:

x = randn(10000,1);
h = histogram(x)

saveas(gcf, 'test','epsc')

生成的后记包含某种形式的原始 位图。当嵌入到 pdf 中时,这看起来真的很难看。

如何将直方图保存为矢量图形?

最佳答案

您也可以将图形保存为使用矢量图形的 pdf。

x = randn(10000,1);
h = histogram(x);

% set proper paper size before generating pdf
set(gcf, 'Units', 'Inches');
pos = get(gcf, 'Position');
set(gcf, 'PaperPositionMode', 'Auto', 'PaperUnits', 'Inches', 'PaperSize', [pos(3), pos(4)]);
print(gcf, 'test.pdf', '-dpdf', '-r0');

免责声明 当我在 LaTeX 文档中嵌入图形时,我经常使用这段代码,但我很确定我是从网上的某个地方复制的(可能是这样)。

关于matlab - 如何将 Matlab 直方图保存为矢量图形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49078762/

相关文章:

c++ - 有没有什么功能等同于Matlab在OpenCV中的imadjust with C++?

xaml - 将 Canvas 与多条路径合并为一条路径

printing - 使用 maskdict 在 postscript 中进行图像屏蔽

matlab - 对重叠三角形曲线下的累积面积求和

matlab - 如何获得矩阵中所有可能的元素组合,但不允许在列之间交换元素?

java - JDK 中的类可以处理图像跟踪过程的哪些部分?

css - 使用 feColorMatrix 匹配 SVG 中的颜色

latex - 如何从 postscript/gnuplot 转换为 pdf 并保留 latex 文档的重音字母?

latex - 检测 LaTeX 中的输出设备

arrays - MATLAB:将 N x 4 数组置换并 reshape 为 2 x 2 x N 数组