I am using pandas and matplotlib to plot data from an experiment involving 5 sessions. I would like the data for each session to be displayed in a separate panel; I am attempting to use subplotting to do this.
I nearly have what I want using the code below (see example figure here: http://imgur.com/99nK2TR). The problem is that different sessions have different numbers of trials and the scale is changed for different panels when I plot. I want the scale to be the same in all plots and the size of the subplot bounding box to adjust instead. Specifically, the trials should be equally spaced across all panels and consequently panels S1 and S2b (which contain 12 trials each) will be wider than panels S2a, S3a and S3b (which contain 3 trials each).
I think I might have to use some combination of aspect and/or adjustable and/or sharex but I can't fathom out how...
Apologies for the shoddy coding I'm new =)
fig,([ax1,ax2,ax3,ax4,ax5]) = plt.subplots(1, 5, sharey=True)
dfsubset1.plot(xticks=range(1,13,1), xlim=[0,13], ylim=[0,35], ax=ax1, title='S1', figsize=(12, 6), style='o-', legend=False)
dfsubset2.plot(xticks=range(1,4,1), xlim=[0,4], ylim=[0,35], ax=ax2, title='S2a', figsize=(12, 6), style='o-', legend=False)
dfsubset3.plot(xticks=range(1,13,1), xlim=[0,13], ylim=[0,35], ax=ax3, title='S2b', figsize=(12, 6), style='o-', legend=False)
dfsubset4.plot(xticks=range(1,4,1), xlim=[0,4], ylim=[0,35], ax=ax4, title='S3a', figsize=(12, 6), style='o-', legend=False)
dfsubset5.plot(xticks=range(1,4,1), xlim=[0,4], ylim=[0,35], ax=ax5, title='S3b', figsize=(12, 6), style='o-', legend=False)