Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove xticks and yticks from all axes?

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?

like image 265
Masoud Zayyani Avatar asked Feb 04 '23 06:02

Masoud Zayyani


2 Answers

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', [] );
like image 58
b3. Avatar answered Feb 06 '23 18:02

b3.


This should work:

set(get(gcf,'Children'),'Xtick',[],'Ytick',[]);
like image 20
Luis Mendo Avatar answered Feb 06 '23 18:02

Luis Mendo