# Stack Plot

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.

#!/usr/bin/env python

import asciitable
# To use the variables in asciitable use col1, col2, etc..

from pylab import *

f = figure()

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

···

--
View this message in context: http://old.nabble.com/Stack-Plot-tp33468632p33468632.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Perhaps GridSpec is what you need:

http://matplotlib.sourceforge.net/users/gridspec.html

Cheers!
Ben Root

···

On Thu, Mar 8, 2012 at 5:05 PM, Trillian <singlebinary@…287…> 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.

#!/usr/bin/env python

import asciitable

# To use the variables in asciitable use col1, col2, etc…

from pylab import *

f = figure()

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

Perfect! That is what I was looking for!

Thanks a lot!

Trillian

Benjamin Root-2 wrote:

···

On Thu, Mar 8, 2012 at 5:05 PM, Trillian <singlebinary@...287...> 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.

#!/usr/bin/env python

import asciitable
# To use the variables in asciitable use col1, col2, etc..

from pylab import *

f = figure()

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

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
View this message in context: http://old.nabble.com/Stack-Plot-tp33468632p33474293.html
Sent from the matplotlib - users mailing list archive at Nabble.com.