Control Figure Size and Position with Automatic Whitespace Removal

Resource Overview

When creating figures in MATLAB for research paper submissions, specific size requirements must be met. However, default MATLAB settings often produce figures with uncontrollable dimensions and excessive whitespace margins. This program enables precise control over figure size and positioning while automatically eliminating unnecessary whitespace through advanced bounding box calculations.

Detailed Documentation

When preparing figures for research paper submissions using MATLAB, careful attention must be paid to figure dimensions. The default MATLAB figure settings often result in uncontrollable figure sizes with substantial unwanted whitespace margins. To address these issues, we have developed a program that automatically adjusts figure size and positioning while eliminating excess whitespace through sophisticated bounding box detection algorithms. Our implementation utilizes MATLAB's Position property for precise dimension control and employs tight bounding box calculations to minimize margins. With our program, you can easily customize figure parameters such as width, height, and aspect ratio to meet specific publication requirements. The code includes functions for setting exact pixel dimensions and automatically recalculating axis positions to maximize content area. Furthermore, our program supports multiple output formats including PDF, PNG, and EPS with maintained dimension precision, facilitating convenient sharing and integration of professionally formatted figures.