File Exchange

image thumbnail

tightPlots

version 1.8.0.0 (5.99 KB) by Theodoros Michelis
Plots and subplots with adjustable margins, gaps, axis aspect ratio and figure size.

6 Downloads

Updated 06 Mar 2015

View License

tightPlots is a function that allows making single plots or subplots with controlled size and margins. The desired (page) width, aspect ratio and margins must be input, with which the appropriate height is calculated.

This workflow allows for all figures to maintain font formatting when they are inserted into a document/publication. Adjust the width to match the document page width and fix the font size. Narrow plots can then be created by Setting wide side margins.
The function additionally creates a bounding box equal to the figure size on the screen. As a result, what is seen on the monitor can be printed in both raster (.png) and vector (.eps, .pdf) formats with the same result.

tightPlots has been influenced by the "tight_subplot" function of Pekka Kumpulainen, hence, parts of the code and parameter names were kept the same.

Comments and Ratings (10)

ziyong han

Qi Yan

Very helpful for producing good-looking figures! Thanks a lot.

Dev-iL

Useful submission! In HG2 versions of MATLAB, the returned values should be of type `handle` and not `double`.

Nice function.
But it needs a slight modification for the new graphics system of post-2014b versions.

Great function!
Works very well for publications.

Valeriy

Very useful and convenient function, thanks a lot

Giuseppe

This function is awesome, finally I can stop using the stupid subplot function!
Thanks!!

jose

Clean and easy to use for publication purposes.

It is not supposed to resize a figure. Rather, you create a figure with the desired width for your document and then fill it with axes.

Matthew

This function does not do figure resize, it cuts off tick labels, code comments are non -standard (H1 line), ....

Updates

1.8.0.0

Changes for compatibility with MATLAB 2014b versions and above.

1.7.0.0

Title fix

1.6.0.0

1) Description extension
2) Example updates
3) Bug fixes

1.5.0.0

Tested with Matlab versions 2012a, 2012b, 2013a, 2013b and 2014a

1.4.0.0

Change of additional axis settings.

1.3.0.0

Worked around a cropped bounding box issue when exporting to post script by introducing an additional axis.

1.2.0.0

Resizing of figure with mouse is no longer allowed. Small change in example 1, for better demonstration.

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux