title: How do I draw a line connecting subplots in pyplot?
body: <p>I would like to create lines between subplots in pyplot as illustrated by the red dashed lines here (added in a pdf editor).</p>
  
  <p><a href="https://i.stack.imgur.com/lxIdM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lxIdM.png" alt="enter image description here"></a></p>
  
  <p>I've read documentation on connectionpatch, but I'm having difficulty making sense of the examples well enough to translate to my particular case. For my case, I've included a simplified version of my code, using the same axes structures in case that is relevant. How do I create these dashed lines between subplots?</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  
  # Create a 2 x 2 grid: (row, column) 
  fig, ax = plt.subplots(2,2) 
  
  # Create a subplot to share common x and y labels
  fig.add_subplot(111, frameon=False)
  plt.tick_params(
  top='off', 
  bottom='off', 
  left='off', 
  right='off')
  plt.grid(False)
  plt.xlabel('x')
  plt.ylabel('function(x)')
  
  # x-axis
  x = np.linspace(0,2*np.pi,100)
  
  # Top left
  ax[0,0].tick_params(
  axis='both',       
  which='both',     
  bottom=False,      
  left=False,
  top=False,         
  right=False,
  labelbottom=False, 
  labelleft=False,)
  ax[0,0].plot(x,np.sin(x),color='grey')
  
  # Top Right
  ax[0,1].tick_params(
  axis='both',       
  which='both',      
  bottom=False,   
  left=False,
  top=False,        
  right=False,
  labelbottom=False, 
  labelleft=False,)
  ax[0,1].plot(x,np.sin(2*x),color='grey')
  
  
  # Bottom Left
  ax[1,0].tick_params(
  axis='both',       
  which='both',      
  bottom=False,      
  left=False,
  top=False,         
  right=False,
  labelbottom=False, 
  labelleft=False,)
  ax[1,0].plot(x,np.cos(x), color='black')
  
  # Bottom Right
  ax[1,1].tick_params(
  axis='both',      
  which='both',     
  bottom=False,      
  left=False,
  top=False,         
  right=False,
  labelbottom=False, 
  labelleft=False,)
  ax[1,1].plot(x,np.cos(2*x), color='black')
  
  plt.tight_layout(h_pad=2.5)
  </code></pre>