|
From: Tony Yu <ts...@gm...> - 2012-04-26 17:02:31
|
On Thu, Apr 26, 2012 at 12:51 PM, willfurnass <wi...@th...> wrote: > > I've converted a simple MATLAB script [1] for wavelet decomposition-based > analysis to Python. I now want to create figures similar to [2] that > feature five subplots in one column, with the 1st and 3rd being generated > using 'subplot.plot' and the others being generated using 'subplot.imshow'. > > I want to find a way of scaling the x and y axes of all subplots so that > they're the same size on screen across all subplots. Unfortunately I can't > find any combination of 'aspect' or 'extent' that will let me do this. I > should note that I've added colorbars to all my image plots; the problem > exists regardless of whether these are used. > > Has anyone got any suggestions? Apologies if this is a trivial matter; I'm > fairly new to MP. > > FYI I'm using matplotlib v1.1.0. > > [1] > > http://www.mathworks.com/matlabcentral/fileexchange/18409-comparing-time-series-using-semblance-analysis > [2] http://www.mathworks.com/matlabcentral/fx_files/18409/1/goldoil.jpg > > Regards, > > Will Furnass > > You could try fig, axes = plt.subplots(nrows=5, sharex=True, sharey=True) And then call `axes[0].plot(...)` and `axes[1].imshow(...)`. You could also unpack the axes array and access them that way (if you prefer): ax0, ax1, ax2, ax3, ax4 = axes ax0.plot(...) Best, -Tony |