title: Matlab - Move Y-Axis to origin?
body: <p>I know that Matlab sometimes isn't the best tool to create "fancy" plots but since my university requires it I dont have much choice. </p>
  
  <p>I want to move the Y-Axis and the "arrow"-Annotation of the following example to x=0.</p>
  
  <pre><code>X = -pi/2 : 0.001 : pi/2;
  Y = cos(X).^2;
  plot(X, Y,'Color',[0,0,1]);
  
  ylim([0 1.2]);
  set(gca, 'YTick',[1.2],'yticklabel',{'{\color[rgb]{0,0,1}X(f)}'});
  set(gca, 'XTick',[-pi/2,pi/2],'xticklabel',{'-f_{max}' 'f_{max}'});
  
  set(gca,'fontsize',16);
  box off;
  grid off;
  fig_pos=get(gca,'Position');
  xp1=fig_pos(1);
  xp2=fig_pos(1)+fig_pos(3)+0.02;
  yp1=fig_pos(2);
  yp2=fig_pos(2)+fig_pos(4)+0.03;
  a1=annotation('arrow', [xp1 xp2],[yp1 yp1]);
  a2=annotation('arrow', [xp1 xp1],[yp1 yp2]);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/S4kqf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S4kqf.png" alt="enter image description here"></a></p>
  
  <p>I tried to use PlotAxesAtOrigin and axescenter of the FileExchange but due to the annotations this doesn't work properly. </p>
  
  <p>Does anyone know a way to make this work?</p>
  
  <p>Thanks for your help, Klaus!</p>