MATLAB: Change scaling of x-axis MATLABrescale x-axis I have data in IDCount(1,:) that goes from 0 to, say, 260. I want to rescale so the x-axis will appear in seconds — IDCount(1,:)/140. Cannot see how to do this Best Answer Try this:x = 0:260; % Create Datay = rand(size(x)); % Create Datafigure(1)plot(x, y)xt = get(gca, 'XTick'); % 'XTick' Valuesset(gca, 'XTick', xt, 'XTickLabel', xt/140) % Relabel 'XTick' With 'XTickLabel' ValuesThe set call relabels the 'XTick' values with the same values divided by 140. Related SolutionsMATLAB: Deletting X and Y axes ticks set(gca,'xtick',[]) set(gca,'ytick',[]) MATLAB: How to scale a plot to fit a plot window without white end xlim([0 260]) Related QuestionManipulating X-Axis ValuesCreate custom x-axis for ‘imagesc’ plotSpectrogram x axis logarithmicHow to change the x-axis label on a SEMILOGX plot from exponential to normal format in MATLABRemove certain yticklabels from axisChanging numbers near X-axis when plotting
Best Answer