4

I have three axes in figure and I want to remove xtick and ytick from all of them. I wrote below code but it works just on current axes, not all of them:

set(gca,'xtick',[],'ytick',[]);

How to remove xticks and yticks from all axes?

Sardar Usama
  • 19,536
  • 9
  • 36
  • 58
Masoud Zayyani
  • 157
  • 1
  • 2
  • 12

2 Answers2

6

As a more general solution inspired by @Luis Mendo's answer, use findobj to get the axes. This will avoid getting all children of the parent figure which could include "non-axes" elements:

set( findobj( gcf, 'Type', 'axes' ), 'XTick', [], 'YTick', [] );
b3.
  • 7,094
  • 2
  • 33
  • 48
2

This should work:

set(get(gcf,'Children'),'Xtick',[],'Ytick',[]);
Luis Mendo
  • 110,752
  • 13
  • 76
  • 147