I want to increase spacing between x-axis points so that, for example in the plot below, the distance between 10 30 increases and the distance between 1150 and 1300 decreases.
1 Answers
Answer to new question (distorting the x-axis field to affect points):
Unfortunately my research shows no built-in way to do this in MATLAB. I see others suggesting:
Distorting the field in your own data, e.g. change x-value from 10, 30, and 50 to 100, 300, and 500 to get 10x magnification, then add 500 to all other x-values so they shift to the right; and then modifying the labels (see below) to read "10", "30", "50", "100", etc.
Using a histogram, where your x-axis labels become bins, e.g. 10, 30, 50, 100, etc. and you use empty bins to space the points.
Answer to old question (affecting x-axis labels and ticks, not points):
From the MathWorks docs, it appears you can arbitrarily set the tick locations, whether uniform or not:
ax = gca;
ax.XTick = [-3*pi -2*pi -pi 0 pi 2*pi 3*pi];
ax.YTick = [-1 -0.5 0 0.5 1];
% For R2014a and earlier:
% ax = gca;
% set(ax,'XTick',[-3*pi -2*pi -pi 0 pi 2*pi 3*pi])
% set(ax,'YTick',[-1 -0.5 0 0.5 1])
So, write a function that creates the spacing you desire and assign its return to XTick
. In your case, it looks like you just need to retrieve the domain values of the points you want to plot.