Effacer les filtres
Effacer les filtres

How to set x-axis labels under certain tick marks?

10 vues (au cours des 30 derniers jours)
Tom Ruopp
Tom Ruopp le 2 Mar 2016
Commenté : Tom Ruopp le 3 Mar 2016
Is there a simple way to define tick mark labels? For example I have attached a plot which I would like to change. Instead of having the default tick labels, I would like to programmatically put tick labels under the positions of 20,60,100,and 120 (and get rid of the numerical tick labels). At this point those positions would be consistent but in the future they may change.

Réponse acceptée

Image Analyst
Image Analyst le 2 Mar 2016
Try this:
ax = gca; % Get handle
ax.XTicks = [20,60,100,120]
ax.XTickLabel = {'','','',''} % Labels are null.
  2 commentaires
Tom Ruopp
Tom Ruopp le 3 Mar 2016
Thank you! The only issue is that
ax.Ticks
should be
ax.Tick
Without the 's'

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by