Much of your code is ‘over the horizon’ and so out of sight.
Try something like this:
x = 0:500;
y = randn(size(x));
figure
plot(x, y)
xt = get(gca, 'XTick');
xtlbl = linspace(-150.36, 265.8773, numel(xt));
set(gca, 'XTick',xt, 'XTickLabel',xtlbl, 'XTickLabelRotation',30)
I know you are displaying an image, not data, however this should work. Note that you need to define the location of the x-tick labels with respect to the original x-tick values. They do not have to be the actual x-tick values (as I use here), however they must be within that range.
Something like this would also work:
xtnew = linspace(min(xt), max(xt), 5);
xtlbl = linspace(-150.36, 265.8773, numel(xtnew));
set(gca, 'XTick',xtnew, 'XTickLabel',xtlbl)
Note that ‘xtnew’ spans the original ‘xt’ range. It just defines them differently.
.
Best Answer