MATLAB: I have to plot a graph where +1 and -1 are located at same point on x axis. How to do that

axesgraphplot

I want the scale on X axis to be like this
and the values of x,y are as follows (-0.6,0.9) (-0.7,0.8) (-.95,0.6) (0.6,0.5) (0.7,0.4) (1,0.3) (0.8,0.4) (0.6,0.5)(0,0.5)(-0.6,0.6) (-0.7,0.8) (-0.6,0.9)

Best Answer

Here is how I would do it. Your proposed tick values don't work perfectly with your data, but you can adjust it.
% given data
data_values = [ -0.6,0.9; -0.7,0.8; -.95,0.6; 0.6,0.5; 0.7,0.4; ...
1,0.3; 0.8,0.4; 0.6,0.5; 0,0.5; -0.6,0.6; -0.7,0.8; -0.6,0.9];
% put your desired ticks here
xticklables=[-.6,-.65,-.7,-.75,-.8,-.85,-.9,-.95,1,.95,.9,.85,.80];
% transform ticks to new scale
xtick=-xticklables;
idx=xtick<0;
xtick(idx)=xtick(idx)+2;
% transform the data to the new scale
data_values(:,1)=-data_values(:,1);
idx=data_values(:,1)<0;
data_values(idx)=data_values(idx)+2;
% plot and adjust labels
scatter(data_values(:,1), data_values(:,2));
xlim([min(xtick), max(xtick)]);
set(gca,'xtick',xtick);
set(gca,'xticklabel',xticklables);