From: Jae-Joon L. <lee...@gm...> - 2009-12-03 03:22:14
|
This happens because, when the AxesGrid is created, gca() is set to the last axes, which is the last colobar axes. If you use axes_grid toolkit, you'd better not use pyplot command that works on axes. Instead, use axes method directly. For example, instead of "pyplot.pcolor(..)" , use "ax.pcolor(..)". Regards, -JJ On Wed, Dec 2, 2009 at 2:18 PM, Ryan Neve <rya...@gm...> wrote: > Hello, > > I'm trying to use AxesGrid but I'm running into a problem: > I can plot a single pcolor plot: > [image: 58dFK.png] > But when I try to use AxesGrid, my pcolor plot is ending up where I expect > my colorbar to be. > [image: mEbTA.png] > > I want to have up to 6 of these plots stacked vertically, sharing a common > time axis and y (depth) scale. > > I'll try to simplify my code to show what I'm doing: > > # I have arrays x_grid and y_grid for time and water depth. > # z_dim is a dictionary of arrays (one for each plot) > # In the plot above it has two arrays. > from matplotlib import pyplot > nrows = len(z_dim) # Number of rows is the number of arrays > My_figure = pyplot.figure(1,(8,8)) > my_grid = AxesGrid(My_figure, 111, #Is this always 111? > nrows_ncols = (nrows,1), # Always one column > axes_pad = 0.1, > add_all=True, > share_all=True, # They all share the same time and depth > scales > label_mode = "L", > cbar_location="right", > cbar_mode="each", > cbar_size="7%", > cbar_pad="2%", > ) > for row_no,parameter in enumerate(z_dim): > ax = my_grid[row_no] > ax = pyplot.pcolor(x_grid,y_grid,z_dim[parameter]) > pyplot.draw() > pyplot.show() > > I eventually want to end up with something like this matlab output (which I > didn't generate): > [image: jiIaK.png] > but without the duplication of x scales. > > I'm new to pyplot and even after reading the documentation much of this is > baffling. > > -Ryan > > > > ------------------------------------------------------------------------------ > Join us December 9, 2009 for the Red Hat Virtual Experience, > a free event focused on virtualization and cloud computing. > Attend in-depth sessions from your desk. Your couch. Anywhere. > http://p.sf.net/sfu/redhat-sfdev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |