How to display only selected xticks?

33 visualizaciones (últimos 30 días)
Csanad Levente Balogh
Csanad Levente Balogh el 9 de Mzo. de 2021
Comentada: Csanad Levente Balogh el 10 de Mzo. de 2021
HI!
I am trying to display onli thee selected xticks om a stairs plot. I use the following code:
figure
stairs(fl,db(sqrt(sTO)))
irs(cfm(6:end),db(sqrt(p(6:end))))
xticks(ff)
xticklabels(cfs);
xtickangle(45)
set(gca,"XScale","log")
Even though I set xticks, the default ticks appear too.
I also tried puting
set(gca,'xtick',[])
before seting the x ticks. It didn't work. How can I display the wanted xticks without the default tickes?

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 9 de Mzo. de 2021
The xticks function should be all you need.
X = linspace(0,4*pi,40);
Y = sin(X);
figure
stairs(Y)
xticks([7 12 18 33])
  3 comentarios
Cris LaPierre
Cris LaPierre el 10 de Mzo. de 2021
Those are minor ticks. They have a different setting. Try this.
X = linspace(0,4*pi,40);
Y = sin(X);
figure
stairs(Y)
xticks([7 12 18 33])
set(gca,"XScale","log")
set(gca,"XMinorTick","off")
Csanad Levente Balogh
Csanad Levente Balogh el 10 de Mzo. de 2021
This works! Thank you!

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by