문제

How can I change e.g. the x-ticks from 1...10 to 2...20 without changing the plot?

I'm plotting frequencies. The Problem is that the first frequency in the matrix doesn't start at zero but at e.g. 200. So the scales start at zero what leads to a misunderstanding...

도움이 되었습니까?

해결책

>> surf(peaks)
>> ticklabels = get(gca,'XTickLabel');
>> newTicklabels = [ticklabels(2:end,:);'60'];
>> set(gca,'XTickLabel',newTicklabels);

Note that ticklabels are returned by the second line (above) is a 2 column char matrix. It can also be specified as a cell array of char (strings) which is often more convenient.

>> set(gca,'XTickLabel',{'1','14','341','123412','1432','1'}); % "random" labels
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top