How do I remove the border lines surrounding an axes?
Show older comments
When I make a simple plot, I would like to turn off the border around the axes. However,
box off
removes only part of the border. I have removed all of the tick marks and labels, but there are still 2 border lines present. Is there a way to remove them?
You can reproduce the issue as follows:
hAx = axes;
set(hAx, 'box','off','XTickLabel',[],'XTick',[],'YTickLabel',[],'YTick',[])
Accepted Answer
More Answers (1)
Royi Avital
on 12 Jan 2024
In newer MATLAB versions this can be done using the XAxis and YAxis sub objectes:
hF = figure();
hA = axes(hF);
set(hA, 'XTick', [], 'XTickLabel', []);
set(hA, 'YTick', [], 'YTickLabel', []);
set(get(hA, 'XAxis'), 'Visible', 'off');
set(get(hA, 'YAxis'), 'Visible', 'off');
This will result in a clean axes.
1 Comment
Matt
on 1 Feb 2024
Hi Royi, thank you for bringing this to our attention. I have updated the article to incorporate this work around.
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!