Sorry for the delay.
I don't know if I ever included my software versions:
Python & IDLE 2.6.2
matplotlib 0.99.0
numpy 1.4.0rc1 (I was using 1.3.0)
Here is more complete code. This is the only place I use matplotlib for
anything so I don't think any earlier code should affect the plot.
I've included the values of the input variables below and I could include
all the code which gets the data and manipulates it if this would help.

def plotGrid(x_dim,y_dim,z_dim,long_name,units,contours=16):
    """
    This will create a frame for all the sub plots. There will be one row
(subplot) per parameter. There will be one column.
    All plots will share their x scale (time)
    Each row will have its own y scale and legend
    """
    from matplotlib import pyplot
    from mpl_toolkits.axes_grid import AxesGrid
    from numpy import meshgrid, transpose
    nrows = len(z_dim) # Number of rows
    print('there are',nrows,'rows') # Confirm that the number of rows is as
expected.
    fig_h_size = 20. # figure width in inches
    fig_v_size = 8. # figure height in inches
    dev_mult = 3 # How many standard deviations to mask out.
    x_grid,y_grid = meshgrid(x_dim,y_dim)
    x_grid = transpose(x_grid)
    y_grid = transpose(y_grid)

    # Start the plotting routines
    DAP_figure = pyplot.figure(1,(fig_h_size,fig_v_size))
    pyplot.title('Title goes here')
    pyplot.figtext(0.05,.5,"Depth
(m)",rotation='vertical',verticalalignment='center')
    # Create a grid of axes with the AxesGrid helper class
    my_grid = AxesGrid(DAP_figure, 111, # Only one grid in DAP_figure
                    nrows_ncols = (nrows,1),
                    axes_pad = 0.0, # pad between axes in inches
                    aspect=False, # By default (False), widths and heigths
of axes in the grid are scaled independently. If True, they are scaled
according to their data limits
                    add_all=True, # Add axes to figures if True (default
True)
                    share_all=True, # xaxis & yaxis of all axes are shared
if True (default False)
                    label_mode = "L", # location of tick labels thaw will be
displayed. "1" (only the lower left axes), "L" (left most and bottom most
axes), or "all"
                    cbar_location="right", # "right" or "top"
                    cbar_mode="each", # "None","single", or "each"
                    cbar_size="2%",
                    cbar_pad="1%",
                    )

    for i,parameter in enumerate(z_dim):
        z_dim[parameter] = maskDAP(z_dim[parameter],parameter,dev_mult)
#Need to mask each grid
        ax = my_grid[i].pcolor(x_grid,y_grid,z_dim[parameter])
        print('from',x_grid[0][0],'to',x_grid[-1][0])
        my_grid[i].set_ylabel(long_name[parameter]) # Puts a y label on
every graph. Eventually we want this labeled only once.
        my_grid.cbar_axes[i].colorbar(ax)

my_grid.cbar_axes[i].axis["right"].toggle(ticklabels=True,label=True)
        my_grid.cbar_axes[i].set_ylabel(units[parameter])

    # Now show it
    pyplot.draw()
    pyplot.show()
    return x_grid, y_grid, my_grid #Useful only for debugging. There is no
code after this.

Here are some typical values for the inpit variables if it helps,

x_dim, time in epoch seconds, is:
array([1253250000, 1253251800, 1253253600, 1253255400, 1253257200,
       1253259000, 1253260800, 1253262600, 1253264400, 1253266200,
       1253268000, 1253269800, 1253271600, 1253273400, 1253275200,
       1253277000, 1253278800, 1253280600, 1253282400, 1253284200,
       1253286000, 1253287800, 1253289600, 1253291400, 1253293200,
       1253295000, 1253296800, 1253298600, 1253300400, 1253302200,
       1253304000, 1253305800, 1253307600, 1253309400, 1253311200,
       1253313000, 1253314800, 1253316600, 1253318400, 1253320200,
       1253322000, 1253323800, 1253325600, 1253327400, 1253329200,
       1253331000, 1253332800])
y_dim, water depths in meters, is:
array([ 0. , -0.1, -0.2, -0.3, -0.4, -0.5, -0.6, -0.7, -0.8, -0.9, -1. ,
       -1.1, -1.2, -1.3, -1.4, -1.5, -1.6, -1.7, -1.8, -1.9, -2. , -2.1,
       -2.2, -2.3, -2.4, -2.5, -2.6, -2.7])
in the example plot below z_dim is a dictionary with three arrays,
'do','chl','turb'.
as an example, z_dim['chl'] (chlorophyl) is a 2D array of the form:
masked_array(data =
 [[-- 14.8400002718 14.8400002718 ..., 13.1000023892 -- --]
 [-- 15.0 15.0 ..., -- -- --]
 [-- 13.1241378212 13.1241378212 ..., -- -- --]
 ...,
 [-- 12.081481385 12.081481385 ..., 10.3037038589 -- --]
 [-- 11.0882356451 11.0882356451 ..., 9.95714437393 -- --]
 [-- 13.4448273754 13.4448273754 ..., -- -- --]],
             mask =
 [[ True False False ..., False  True  True]
 [ True False False ...,  True  True  True]
 [ True False False ...,  True  True  True]
 ...,
 [ True False False ..., False  True  True]
 [ True False False ..., False  True  True]
 [ True False False ...,  True  True  True]],
       fill_value = 1e+20)

Here's the plot as it stands now:
[image: fgpXr.png]

Thank you again for your time.

On Fri, Dec 4, 2009 at 4:07 PM, Jae-Joon Lee <lee.j.j...@gmail.com> wrote:

>
> Please, "more" complete example does not make any difference unless it is
> complete.
>
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to