How to remove certain tick labels from xaxis in line plot
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Aaron Ouyang
le 12 Juil 2022
Réponse apportée : Star Strider
le 12 Juil 2022
Hi,
I've been graphing this line plot. Currently my x-axis has tick labels from 0 to 3000 seconds in 500 second intervals as shown below. How can I remove all the x-axis tick labels except for the label at 3000? Thanks.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1063280/image.png)
0 commentaires
Réponse acceptée
Star Strider
le 12 Juil 2022
Try something like this —
t = linspace(0, 3000, 3000);
s = (sin(2*pi*t*5)>0.9)*6.8 + 0.1;
figure
plot(t, s)
figure
plot(t, s)
xt = xticks;
set(gca,'XTick',max(xt));
.
0 commentaires
Plus de réponses (1)
Anay Aggarwal
le 12 Juil 2022
Hi Aaron,
I have an understanding that you want to remove tick labels from the x-axis.
Please refer to the following page for details.
Regards
0 commentaires
Voir également
Catégories
En savoir plus sur Axis Labels dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!