Custom labels for the axes - Problem when expanding window

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!

Answers (1)

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.

Asked:

on 7 May 2016

Answered:

dpb
on 7 May 2016

Community Treasure Hunt

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

Start Hunting!