## Re: [Matplotlib-users] setting x/yrange on a pcolor plot

 Re: [Matplotlib-users] setting x/yrange on a pcolor plot From: Ben Elliston - 2010-12-16 06:40:25 ```On Wed, Dec 15, 2010 at 08:02:42PM -0600, Benjamin Root wrote: > Assuming you are doing a pcolor on some 2-D numpy array called 'z': > > ax.set_xlim(xmax=z.shape[1]) > ax.set_ylim(ymax=z.shape[0]) Thanks. I also found (after a bit of digging) that I could just use: axis ('off') Cheers, Ben ```

 [Matplotlib-users] setting x/yrange on a pcolor plot From: Ben Elliston - 2010-12-15 22:08:41 ```I am trying to plot an 840 x 680 element matrix using pcolor. matplotlib has decided that the xrange should be 900 and the yrange 700. Is there a way to tell matplotlib to always use x/yranges that always match the dimensions of the matrix? Thanks, Ben ```
 Re: [Matplotlib-users] setting x/yrange on a pcolor plot From: Benjamin Root - 2010-12-16 02:03:09 Attachments: Message as HTML ```On Wed, Dec 15, 2010 at 4:08 PM, Ben Elliston wrote: > I am trying to plot an 840 x 680 element matrix using pcolor. > matplotlib has decided that the xrange should be 900 and the yrange > 700. Is there a way to tell matplotlib to always use x/yranges that > always match the dimensions of the matrix? > > Thanks, Ben > > Assuming you are doing a pcolor on some 2-D numpy array called 'z': ax.set_xlim(xmax=z.shape[1]) ax.set_ylim(ymax=z.shape[0]) That should make everything look right. You could also consider using imshow() which will automatically trim the limits for you. imshow() and pcolor() are slightly different, but can often serve similar purposes. I hope that helps! Ben Root ```
 Re: [Matplotlib-users] setting x/yrange on a pcolor plot From: Ben Elliston - 2010-12-16 06:40:25 ```On Wed, Dec 15, 2010 at 08:02:42PM -0600, Benjamin Root wrote: > Assuming you are doing a pcolor on some 2-D numpy array called 'z': > > ax.set_xlim(xmax=z.shape[1]) > ax.set_ylim(ymax=z.shape[0]) Thanks. I also found (after a bit of digging) that I could just use: axis ('off') Cheers, Ben ```