MATLAB: Xlim command for figures

datafigurexlim

xlim command changes the axis limit of the figure.
How can i also limit data that is contained by the figure?
Appearently, even though xlim is applied data is still there.

Best Answer

cleanfigure.m file from matlab2tikz can take care of this issue.