Reputation: 8538
I am trying to export only the plot excluding all the axes and the padding on each side of the plot in Matlab. I removed the axes using the command :
set(gca, 'Visible','off');
Any idea how exclude the padding as well from the plot ?
Thanks
I am looking for an image after exporting the plot someething like this :
What I am currently getting is :
Upvotes: 1
Views: 69
Reputation: 7817
This should be enough (you may also need to change the figure background color):
axis off
set(gca,'Position',get(gca,'OuterPosition'));
Basically, the axis settings contain several different position values; Position
is the bounding box around the actual graph, TightInset
the bounding box which also incorporates the axis labels etc., OuterPosition
the outermost. Setting the innermost Position
to equal OuterPosition
just expands your graph to fill the plotting space.
Upvotes: 3