title: Rotating a 2-D plot on MatLab
body: <p>I have a 2-D rectangle that I want to rotate counterclockwise by 45 degrees. I used MatLab help but the functions in there aren't giving me the results I want. I basically have a figure like so:
  <a href="https://stackoverflow.com/questions/25644814/simple-matlab-plot">Simple MatLab plot</a>
  and I want to rotate it by 45 degrees. How can I achieve that? </p>
  
  <hr>
  
  <p>Based on the comment, I decided to try and manually calculate all the points just to check if I can do that and turns out that I am not able to get the rotated rectangle. The code is:</p>
  
  <pre><code>function []=stress_rate_tensor(t)
  
  clear all 
  clc 
  
  plot(0.5, -0.5, 'ob')
  plot(-0.5, -0.5, 'ob')
  plot(0.5, 0.5, 'ob')
  plot(-0.5, 0.5, 'ob')
  
  
  line([-0.5 0.5], [-0.5 -0.5],'Color','k','LineWidth',1)
  line([0.5 0.5], [-0.5 0.5],'Color','k','LineWidth',1)
  line([-0.5 0.5], [0.5 0.5],'Color','k','LineWidth',1)
  line([-0.5 -0.5], [-0.5 0.5],'Color','k','LineWidth',1)% prints the first rectangle
  
  hold off
  
  
  axis([-1.5 1 -1 1])
  hold on
  
  plot(0.5, 0.5, 'ob')
  plot(-0.5, -0.5, 'og')
  plot(-1.16, 0.25, 'or')
  plot(-0.41, 0.91, 'oy')
  
  line([-1.16 0.25], [-0.5 -0.5],'Color','k','LineWidth',1)
  line([-0.41 0.91], [-1.16 0.25],'Color','k','LineWidth',1)
  line([-1.16 0.25], [-0.41 0.91],'Color','k','LineWidth',1)
  line([-0.5 -0.5], [-1.16 0.25],'Color','k','LineWidth',1) % prints the second rectangle
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/OI6B6.png" alt="enter image description here"></p>
  
  <p>which is not what I want. Is there something wrong with my code? </p>