[AstroPy] plot of data and residuals

Fabricio Ferrari fabricio at ferrari.pro.br
Tue Aug 10 09:32:06 EDT 2010


Hello Jonathan

in fact, there was no direct way of doing this in the pre-1.0 versions
of Matplotlib. In the 1.0.0 version there is something called
'gridspec' which does exactly  what you want.

Anyway, if you can't install v.1.0.0 I found a way of doing this,
shown below (I put only the relevant code)

    . . .
    # definitions for the axes
    left  = 0.05
    width = 0.65
    bottom = 0.05
    height = 0.65
    bottom_h = left+width+0.02
    left_h   = left+width+0.02

    rect_image = [left, bottom, width, height]
    rect_profx = [left, bottom_h, width, 0.2]
    rect_profy = [left_h, bottom+0.04, 0.2, height]

    # start with a rectangular Figure
    fig = P.figure(1, figsize=(8,8))

    axProfX = P.axes(rect_profx)
    axProfX.plot(x,y)

    axImage = P.axes(rect_image)
    axImage.imshow(data,origin='lower',interpolation='nearest')

    axProfY = P.axes(rect_profy)
    axProfY.plot(x2,y2)
    . . .


When you need to access plot properties in a particular subplot, you
must invoke the functions via the axis class instances, axProfY,
axProfX, and so on...


..-. ..-.
Fabricio Ferrari       [www.ferrari.pro.br]
Universidade Federal do Pampa
Bagé RS
Brasil



More information about the AstroPy mailing list