MATLAB: Value in x-axis and y-axis not display same as data

gui problem

x-axis should be display value of latitude and y-axis should be display the value of longitude. but when im run GUI with this coding;
table=get(handles.uitable5,'Data'); X=table(:,1); Y=table(:,2); Z=table(:,3);
pointsize = 20; scatter(X, Y, pointsize, Z); colormap([1 0 0; 0 1 0]); %red, green axes(handles.axes1);
the result is like image below which x-axis was display by the value 1,1.002,1.004,1.006,1.008,1.01 and y-axis was display by the value 1,1.0005,1.001,1.0015,1.002,1.0025,1.003.

Best Answer

Actually those values are exactly the same as the data, except that the GUI arrangement obscures the exponential multiplier. Here is a scatter plot with some of those data points, showing the exponential multipliers (highlighted in red):
>> X = [10000;10020;10100];
>> Y = [10000;10010;10020];
>> scatter(X,Y)
Two Solutions
  • arrange the GUI so that the exponential multipliers are visible.
  • manually set the tick label strings, something like this:
>> fun = @(ax)arrayfun(@(n){sprintf('%.0f',n)},get(gca,sprintf('%sTick',ax)));
>> set(gca,'XTickLabel',fun('X'))
>> set(gca,'YTickLabel',fun('Y'))