Is it possible to use axis tics lables without xtics?

2 views (last 30 days)
Is it possible to use axis tics lables without xtics?

Answers (2)

Walter Roberson
Walter Roberson on 23 Nov 2016
If you are using R2014b or later (might require R2015a), you could try setting the XAxis TickLength property to 0. See https://www.mathworks.com/help/matlab/ref/numericruler-properties.html

Star Strider
Star Strider on 22 Nov 2016
It is, but the results are unpredictable. It’s best to use both 'XTick' and 'XTickLabel' together to be certain that what you want is what you get.
  4 Comments
Mr M.
Mr M. on 25 Nov 2016
No, I mean, how is it possible to do make unpredictable results mentioned by you? I know how to use them together.
Star Strider
Star Strider on 25 Nov 2016
The most obvious way is to provide more 'XTickLabel' values (or strings or whatever) than there are original 'XTick' values. So if there are ‘n’ original 'XTick' values and you want to label more than that, only the first ‘n’ of your labels will be displayed. Similarly, if you define fewer than ‘n’, they will be displayed in the corresponding 'XTick' locations, leaving the remaining 'XTickLabel' values blank.
To display all the ones you want to the way you want to, you have to re-define the 'XTick' values to the number you want, and to be within the bounds of the original 'XTick' values, such as I described in my code snippet. If you re-define the axis limits using 'XLim' for example, you have to re-define the 'XTick' and 'XTickLabel' vectors as well.
Experiment with these to see the results.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!