matlab - 如何在不设置位置的情况下在 Matlab 中设置图形大小?

标签 matlab plot

在 Python 中,我可以将大小传递给 figure 指令:

figure(figsize=(8,6))

在 Matlab 中我看不到这种能力。我有复杂的建议,比如

set(gcf, 'PaperPositionMode', 'manual');
set(gcf, 'PaperUnits', 'inches');
set(gcf, 'PaperPosition', [2 1 4 2]);

包括设置大小和位置。

如何在Matlab中以最简单的方式只设置尺寸?

最佳答案

这应该有效:

set(gcf, 'Position', get(gcf,'Position').*[1 1 0 0] + [0 0 newWidth newHeight]);

如果您的 MATLAB 是 R2014b 或更新版本,您还可以:

hF = gcf;
hF.Position(3:4) = [newWidth newHeight];

关于matlab - 如何在不设置位置的情况下在 Matlab 中设置图形大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48003454/

相关文章:

java - 高效地将 Java 列表转换为 Matlab 矩阵

matlab - 如何更改向导创建的GUI图形窗口标题名称?

MATLAB 编程 GUI 列表框值及其引用的数据

matlab - 向量化这个循环

r - ggplot 绘图中的字体大小与使用 knitr 的绘图有关

python-3.x - plot_decision_regions 错误 "Filler values must be provided when X has more than 2 training features."

matlab - 在 matlab 中绘制一堆 3d 线的最有效方法

image - 灰度共现矩阵14个特征实现

r - 在图的顶部添加图例

python27 matplotlib : first and last element connected