title: Rotate plot in matplotlib figure by 90 degree
body: <p>I am trying to rotate plot inside matplotlib figure by 90 degree.
  I found out <a href="https://stackoverflow.com/questions/22540449/how-can-i-rotate-a-matplotlib-plot-through-90-degrees#answer-42978441">this post</a> but it uses pyplot and I am using simple plot so that does not work, Also he doesn't explain the code for rotating pyplot but mentions <strong>transform property</strong> can also be used to rotate simple plot graph. I tried searching online for transformation tutorial but could not understand the concept.</p>
  <p>Here is me code snippet</p>
  <pre class="lang-py prettyprint-override"><code>from matplotlib.figure import Figure
  import numpy
  
  # random data
  data = numpy.random.randn(100)
  
  # making figure on which plot will be draw
  fig = Figure(figsize=(11, 8),dpi=100)
  # adding plot to figure
  plot1 = fig.add_subplot(111)
  # plotting values
  plot1.plot(data)
  
  # saving figure for later use
  fig.savefig(&quot;graph.jpeg&quot;)
  
  </code></pre>
  <p>It produces following result;</p>
  <p><a href="https://i.stack.imgur.com/1mLy2m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1mLy2m.png" alt="current output" /></a></p>
  <p>But I want this kind of output;</p>
  <p><a href="https://i.stack.imgur.com/eaBG9m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eaBG9m.png" alt="required output" /></a></p>