How to remove XTick labels without removing XGrid lines?
Show older comments
Hello
Is it possible to remove the XTick labels in a figure without also removing the XGrid lines? Thereby having a figure with only YTicks labels but with both X- and YGrid lines?
Accepted Answer
More Answers (2)
Daniel Shub
on 27 Sep 2011
plot(1:10)
grid on
set(gca, 'XTickLabel', [])
Javier Sarmiento
on 14 Apr 2016
Edited: Javier Sarmiento
on 14 Apr 2016
0 votes
Hi Morten, complementing the answer given by Wayne, you can choose which grid is with tick and which not by editing these one by one:
set(gca,'xticklabel',{'' [10 20] ''})
The result is two empty ticks (also two ticks with 10 and 20) with grids.
Best regards!
Javier
Categories
Find more on Grid Lines, Tick Values, and Labels 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!