How do I remove the bottom line of the axes in a saved figure?
31 views (last 30 days)
I drew a graph and deleted axes by using the code below.
hAxes = gca;
hAxes.XRuler.Axle.LineStyle = 'none';
However, when I added lines by using 'line' commend to explain each components, the axis at the bottom appeared again as shown below.
I don't know why axis appeared again. Anyway, I drew white lines to hide black axis as shown below.
OK. It looks good to me. However, when I saved the graph as a pdf image, the axes appeared again!
pos = get(gcf,'Position');
Please somebody save me~!!!!
Abby Skofield on 16 Oct 2018
Edited: MathWorks Support Team on 28 Nov 2018
If you do not want the axes outline to appear, you can turn it off using this command:
If you have an area, bar, or stem plot that has a baseline and want to turn off the baseline, set the Visible property of the Baseline object to 'off', for example:
a = area(magic(5));
a(1).BaseLine.Visible = 'off';
If those approaches do not resolve the problem, you can try preserving the plot colors when printing or saving by setting the InvertHardcopy property of the Figure object to 'off' before printing, for example:
More Answers (1)
Akira Agata on 10 Oct 2017
By setting the 'Visible' property of the axes 'off' after plotting your graph, you can remove the axes. Following is a simple example.
% Plotting your graph, like:
% Set the 'visible' property 'off'
ax = gca
ax.Visible = 'off'
% The axes is removed from PDF file, too.