I'm doing a multi panel plot using gridspec, but I'm having a few issues. I want each row to share a different y axis and each column to share a different x axis. Or, in other words, to share x per row and share y per column. I also want to add a label to each of these axis. Here is an example of what I'm talking about along with the code that made that (minus the axis labels I want):
(source: matplotlib.org)
# row and column sharing
f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, sharex='col', sharey='row')
ax1.plot(x, y)
ax1.set_title('Sharing x per column, y per row')
ax2.scatter(x, y)
ax3.scatter(x, 2 * y ** 2 - 1, color='r')
ax4.plot(x, 2 * y ** 2 - 1, color='r')
However I can't exactly use this implementation because I am using subplot2grid as I need to choose the specific positions and dimensions of each plot. I've tried using something sharex=ax1 and sharey = ax1 in the subplot2grid call to no avail. Here is the relevant portion of my code:
ax1 = plt.subplot2grid((8,8), (2,0), colspan=2, rowspan=2)
ax2 = plt.subplot2grid((8,8), (4,0), colspan=2, rowspan=2)
ax3 = plt.subplot2grid((8,8), (6,0), colspan=2, rowspan=2)
ax4 = plt.subplot2grid((8,8), (2,2), colspan=2, rowspan=2)
ax5 = plt.subplot2grid((8,8), (4,2), colspan=2, rowspan=2)
ax6 = plt.subplot2grid((8,8), (2,4), colspan=2, rowspan=2)
ax7 = plt.subplot2grid((8,8), (1,0), colspan=2, rowspan=1)
ax8 = plt.subplot2grid((8,8), (1,2), colspan=2, rowspan=1)
ax9 = plt.subplot2grid((8,8), (1,4), colspan=2, rowspan=1)
ax10 = plt.subplot2grid((8,8), (2,6), colspan=1, rowspan=2)