MATLAB: ‘Createfigure’ function changes the scatter plot slightly, what am I doing wrong

create figurescatter

I use:
>>scatter(COG.X,COG.Z)
then set up the scatter plot as on the picture:
Go to 'File', 'Generate code'
I get my createfigure function, which I save, then command it as:
>>createfigure(COG.X,COG.Z)
and I get this:
Which is the wrong Z – Axis (Y) and my X- Axis has spaces in front and at the back, why? how?
What am I doing wrong??

Best Answer

Working myself through it now,
% Uncomment the following line to preserve the X-limits of the axes

xlim(axes1,[-700 1800]);
% Uncomment the following line to preserve the Y-limits of the axes

ylim(axes1,[-100 900]);
% Set the remaining axes properties

set(axes1,'XGrid','on','XMinorGrid','on','XTick',[-700 1800],...
'YGrid','on','YMinorGrid','on','YTick',[-100 900]);
this ending is almost okay, the only thing I want to tell MatLab now is that from -700 to 1800 I want the graph to step by 100.
I can do it like this
% Uncomment the following line to preserve the X-limits of the axes
xlim(axes1,[-700 1800]);
% Uncomment the following line to preserve the Y-limits of the axes
ylim(axes1,[-100 900]);
% Set the remaining axes properties
set(axes1,'XGrid','on','XMinorGrid','on','XTick',...
[-700 -600 -500 -400 -300 -200 -100 0 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800],...
'YGrid','on','YMinorGrid','on','YTick',...
[-100 0 100 200 300 400 500 600 700 800 900]);
but I feel like that's cheating, and there is got to be a better way of doing this.
with this last ending, I get the right Figure, as well, but getting the right result doesn't always mean you solved the problem right... Right?