title: Adding histogram and 1 std band to residual plot
body: <p>I have plotted a graph in python with a subplot of residuals and am trying to find a way to at a histogram plot of the residuals on the end of the histogram plot. I would also like to add a grey band on the residual plot showing 1 standard deviation.</p>
  
  <p>also is there a way to remove the top and right-hand side boarders of the plot.</p>
  
  <p>Here is a copy of the code and the graph I currently have.</p>
  
  <pre><code>fig1 = pyplot.figure(figsize =(9.6,7.2))
  plt.frame1 =fig1.add_axes((0.2,0.4,.75,.6))
  pyplot.errorbar(xval, yval*1000, yerr=yerr*1000, xerr=xerr, marker='x', linestyle='None')
  
  # Axis labels
  pyplot.xlabel('Height (m)', fontsize = 12)
  pyplot.ylabel('dM/dt (g $s^{-1}$)', fontsize = 12)
  
  
  # Generate best fit line using model function and best fit parameters, and add to plot
  fit_line=model_funct(xval, [a_soln, b_soln])
  pyplot.plot(xval, fit_line*1000)
  
  # Set suitable axis limits: you will probably need to change these...
  #pyplot.xlim(-1, 61)
  #pyplot.ylim(65, 105)
  # pyplot.show()
  
  
  plt.frame2 = fig1.add_axes((0.2,0.2,.75,.2))    #start frame1 at 0.2, 0.4 
  plt.xlabel("Height of Water (m)", fontsize = 12)
  plt.ylabel("Normalised\nResiduals", fontsize = 12)    #\n is used to start a new line
  plt.plot(h,normalised_residuals,"x", color = "green")
  plt.axhline(0, linewidth=1, linestyle="--", color="black")
  
  
  plt.savefig("Final Graph.png", dpi = 500)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/wbd5p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wbd5p.png" alt="Current graph"></a></p>