Save figure with minimal white space
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Dear all,
In the following page, Mathworks explains how to save a figure with minimal white space.
ax = gca;
outerpos = ax.OuterPosition;
ti = ax.TightInset;
left = outerpos(1) + ti(1);
bottom = outerpos(2) + ti(2);
ax_width = outerpos(3) - ti(1) - ti(3);
ax_height = outerpos(4) - ti(2) - ti(4);
ax.Position = [left bottom ax_width ax_height];
I have a figure containing multiple subplots and can't figure out how to make it work. Anyone tips on modifying the commands suggested by Mathworks?
Thank you in advance.
Regards
1 Commento
Jan
il 28 Ago 2017
Today I have selected your code with the mouse and hit the "{} Code" button for a readable formatting. Please do this by your own in the next questions. Thanks.
Risposte (1)
OCDER
il 31 Ago 2017
I had a similar issue and so had to create a series of codes to make this work. Essentially, you'll have to determine the location of the subplots and then manually set the axes. I use the "TightInset" property of each subplot axes handle to determine how much border to leave around each figure, and then adjust the "Position" property of each axes to the right location in the figure.
OR, you can take a look at the codes in this folder:
The codes in the PlotTools folder can be used for matlab plotting jobs. Download and test these files by running testPlotTools.m on your matlab, which shows what each function does. resizeSubplots.m is the function you probably want to use, which resizes all subplots to fill the white space. You can add spacers between the subplots too (see the resizeSubplots help info).
0 Commenti
Vedere anche
Categorie
Scopri di più su Subplots in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!