How to display only selected xticks?
33 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Csanad Levente Balogh
le 9 Mar 2021
Commenté : Csanad Levente Balogh
le 10 Mar 2021
HI!
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/544462/image.jpeg)
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?
0 commentaires
Réponse acceptée
Cris LaPierre
le 9 Mar 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 commentaires
Cris LaPierre
le 10 Mar 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")
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Axis Labels dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!