Removing its deadspace: squeeze_axes(handles)Īs an exercise I let the case where you have an axes occupying more than one space in the grid. Xlabel(sprintf('Xlabel nah (%d,%d)',line,column)) Ylabel(sprintf('Ylabel yeah (%d,%d)',line,column)) Make the most use of the matlab default figure set, adjust the position of the axes of subplot, remove white space,make figure tight. axis vis3d freezes aspect ratio properties to enable rotation of 3-D objects and overrides stretch-to-fill. ![]() Title(sprintf('Cool title (%d,%d)',line,column)) MATLAB adjusts the x-axis, y-axis, and z-axis so that they have equal lengths and adjusts the increments between data units accordingly. Asymmetric subplots with variable inner gaps and outer margins. Handles(line,column)=subplot(nLines,nColumns,column+(line-1)*nColumns) Ploting the common matlab subplot function as follows: figure (curAxesTightPos(1:2) + curAxesTightPos(3:4))] And, of course, it conveniently returns a vector of handles to. NoDeadSpacePos = curAxesOuterPos + [curAxesTightPos(1:2). The syntax is easy to use: ha tightsubplot (Nh, Nw, gap, margh, margw) allows me to specify the number of horizontal axes, the number of vertical axes, the gap as a scalar (or as a vector of horizontal and vertical gap values, gaph gapw), and the height and width margins. % Remove dead space inside subplot border:ĬurAxesTightPos=get(curAxes,'TightInset') Set(curAxes,'OuterPosition',curAxesOuterPos) % Set OuterPosition to occupy as most space as possibleĬurAxesOuterPos = [leftPos(curColumn) botPos(curLine) subplotWidth. LeftPos = linspace(0,1-subplotWidth,nHorSubPlot) % TODO: Make squeeze axes compatible with axes that occupy multipleīotPos = linspace(1-subplotHeight,0,nVertSubPlot) % handles(4,4) is the axes in the forth line and forth column. % handles(1,1) is the axes in the first line and first column, whereas ![]() % -> handles: the subplot axes handles organized as a grid. % squeeze_axes(handles) Squeeze axes to remove dead space. You can omit the parentheses and specify subplot as. subplot(1,1,1) or clf deletes all axes objects and returns to the default subplot(1,1,1) configuration. I have adapted the setCustomPlotArea as follows: function squeeze_axes(handles) However, if the subplot specification exactly matches the position of an existing axes, then the matching axes is not deleted and it becomes the current axes. The short answer is to spread axes position to occupy the whole figure as follows: set(gca,'Position',) % Make the axes occupy the whole figureīut if you want to keep ylabel, xlabel, and so on, you will have to use the following approach: Removing dead space for only one axes figure I answered this at this other topic and also gave an example of how to improve axes (subplot) space usage here (search for the subfunction setCustomPlotArea inside the function kmeans_test).
0 Comments
Leave a Reply. |