Custom labels for the axes - Problem when expanding window
Show older comments
I know that XTickLabel enables one to specify the tick marks on the x-axis.
My problem is that suppose that my labels were: 10,20,30 (referring to grid points) and the data I want to plot is x = [10,20,30] and y = (insert corresponding values). XTickLabel works perfectly fine but once I enlarge the figure window, the x-axis labels become 10,20,30,10,20,30.
How do I resolve this issue?
Thanks!
1 Comment
CS Researcher
on 7 May 2016
Can you share your code?
Answers (1)
dpb
on 7 May 2016
0 votes
If the data to plot are x = [10,20,30] then why are you setting 'xticklabel' at all? Just let the automagic tick values reflect the actual tick values; they'll change dynamically with the axes as they should. 'xticklabel' is only for cases where the tick labels reflect something other than the actual tick value--like a categorical variable instead of ordinal, say. You're creating your own problem by throwing away the correlation of the values with the ticks when don't need to.
Categories
Find more on Grid Lines, Tick Values, and Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!