Enlarge figure axes by a given factor

Given a figure with (eg. tight) axes, this simple code automatically recalculates and enlarges axes them by a prescribed factor.

您现在正在关注此提交

5 examples (the code works in both normal and logarithmic scales):
figure; x=1:100; y=sqrt(x); plot(x,y); axis tight; enlarge_axis(0.1,0.05);
figure; x=1:100; y=sqrt(x); semilogy(x,y); axis tight; enlarge_axis(0.1,0.05);
figure; x=1:100; y=sqrt(x); semilogx(x,y); axis tight; enlarge_axis(0.1,0.05);
figure; x=1:100; y=sqrt(x); loglog(x,y); axis tight; enlarge_axis(0.1,0.05);
figure; sphere; axis image; enlarge_axis;

引用格式

Jan Valdman (2026). Enlarge figure axes by a given factor (https://ww2.mathworks.cn/matlabcentral/fileexchange/79796-enlarge-figure-axes-by-a-given-factor), MATLAB Central File Exchange. 检索时间: .

一般信息

MATLAB 版本兼容性

  • 兼容任何版本

平台兼容性

  • Windows
  • macOS
  • Linux
版本 已发布 发行说明 Action
1.1.0

Now it works in 3D as well.

1.0.0