MATLAB: Add Whitespace to Plot

matlab2tikzplot

Dear Community,
I have a sort of uncommon problem: I have made a graph with matlab with a complexity-label (nothing quantitative) at the x-axis . In my graph there are filled regions, which are extended over the whole graph. At the right end of those areas I have added some text. The text juts out over the axis interval of the graph. If I adjust the width of the figure-window manually, everything fits onto the plot. But as I convert my graph with matlab2tikz and add it into my thesis and as the text is outside of the axis interval, the text is cut off and incomplete. I thought about adding some whitespace, but everything I can find is to eliminate the whitespace of figures.
I hope, anyone can help me with my problem, I'd truly appreciate it! Thanks in advance! Georg

Best Answer

If I understand the issue, use the 'position' property and reduce the width value from its default to something less...that should give you more room on the RH side for the text before it runs into the 'outerposition' boundary.
pos=get(gca,'position'); % retrieve the current values
pos(3)=0.9*pos(3); % try reducing width 10%
set(gca,'position',pos); % write the new values
With HG2 in recent releases you can use the "dot" property notation.
See the doc for Axes Properties and links therein for all the gory details.