image thumbnail

Enlarge figure axis by a given factor

version 1.0.0 (1.67 KB) by Jan Valdman
Given a 2D figure with (eg. tight) axis, this simple code automatically recalculates axis and enlarges them by a prescribed factor.


Updated 2 Sep 2020

View License

Four examples (the code works in both normal and logarithmic scales):

x=1:100; y=sqrt(x); figure; plot(x,y); enlarge_axis(0.1,0.05)

x=1:100; y=sqrt(x); figure; semilogy(x,y); enlarge_axis(0.1,0.05);

x=1:100; y=sqrt(x); figure; semilogx(x,y); enlarge_axis(0.1,0.05);

x=1:100; y=sqrt(x); figure; loglog(x,y); enlarge_axis(0.1,0.05);

Cite As

Jan Valdman (2022). Enlarge figure axis by a given factor (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2020a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!