From: Benjamin R. <ben...@ou...> - 2012-03-09 20:04:22
|
On Thu, Mar 8, 2012 at 5:05 PM, Trillian <sin...@gm...> wrote: > > Hello All, > > How do I control a width and length of a boxes in a stack plot? Currently > with the code I have, I can only control the separation or the white-space > between the two plots. I would like the top plot to be larger in length and > narrow in width while the bottom plot to have the same width as the top but > the length to be much shorter than the top. Please see figure. > > http://old.nabble.com/file/p33468632/RVs.png RVs.png > > > #!/usr/bin/env python > > import asciitable > data = asciitable.read('RVs.dat') > # To use the variables in asciitable use col1, col2, etc.. > > from pylab import * > > f = figure() > subplots_adjust(hspace=1) > > ax1 = subplot(211) > ax1.plot(data.col6,data.col5, 'ko') > ylabel('RV using GJ406') > title('RV comparison') > > ax2 = subplot(212, sharex=ax1) > ax2.plot(data.col6,data.col5-data.col6,'ko' ) > xlabel('RV (km/s)') > ylabel('Residuals (km/s)') > # The line below takes away the x-axis values from top plot. > xticklabels = ax1.get_xticklabels()+ax2.get_xticklabels() > setp(xticklabels, visible=True) > savefig('RVs.png') > > Thanks, > > Trillian > > Perhaps GridSpec is what you need: http://matplotlib.sourceforge.net/users/gridspec.html Cheers! Ben Root |