title: Adjusting gridspec so that plotted data aligns
body: <p>I have several graphs to plot, all having the width a multiple of some unit as in the figure below.
  <a href="https://i.stack.imgur.com/PD34l.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PD34l.png" alt="enter image description here" /></a></p>
  <p>So the bottom axis is 1/4 of the whole width, the second-to-bottom one is 2/4 of the width etc.</p>
  <p>The code I am using:</p>
  <pre><code>import matplotlib.pyplot as plt
  divs = 4
  fig = plt.figure()
  gs = fig.add_gridspec(ncols = divs, nrows = divs)
  axes = [fig.add_subplot(gs[div, div:]) for div in range(divs)]
  for row in range(divs):
      axes[row].plot([1]*10*(divs - row), c = 'r')
      axes[row].set_xlabel('', fontsize = 6)
  fig.set_figheight(10)
  fig.set_figwidth(10)
  plt.show()
  </code></pre>
  <p>My problem is that the plots don't exactly align as I want them to: The plot on row 2 begins slightly to the right of the '10' tick mark on the plot on row 1, and the same applies for the plot on row 3 vs the plot on row 2 etc. I would like the beginning of the plot on row 2 to synchronize precisely with the '10' on row 1, and likewise for the other plots. How is this achievable (not necessarily but preferably using gridspec)?</p>
  <p>I tried adding <code>axes[row].tick_params(axis=&quot;y&quot;,direction=&quot;in&quot;, pad=-22)</code> to push the y-axis inside the plot but that didn't change the alignment. Also I tried using <code>fig.tight_layout(pad = 0.3)</code>: this did not change the alignment either.</p>