[Matplotlib-users] pcolor plot question about empty horizontal strip at top From: - 2004-12-30 02:18:29 Attachments: one.png ```I'm getting great pcolor plots like attached one and learning lots about it. So far so good. One minor question if you don't mind... I'm getting an empty white strip across the top of attached plot as you can see which led me deeper into workings of pcolor function. It seems if your grid has 20 rows ( different y values) of points that you won't get 20 colored horizontal strips but rather *19*. This is because we must lose one row to specify the top and/or bottom EDGE of the plot.... so XX rows means (XX-1) rows of colored squares. Please tell me if this is right but more importantly, how to most wisely remove the white horizontal strip from this pcolor plot. Thanks! chris ```
 [Matplotlib-users] pcolor plot question about empty horizontal strip at top From: - 2004-12-30 02:18:29 Attachments: one.png ```I'm getting great pcolor plots like attached one and learning lots about it. So far so good. One minor question if you don't mind... I'm getting an empty white strip across the top of attached plot as you can see which led me deeper into workings of pcolor function. It seems if your grid has 20 rows ( different y values) of points that you won't get 20 colored horizontal strips but rather *19*. This is because we must lose one row to specify the top and/or bottom EDGE of the plot.... so XX rows means (XX-1) rows of colored squares. Please tell me if this is right but more importantly, how to most wisely remove the white horizontal strip from this pcolor plot. Thanks! chris ```
 Re: [Matplotlib-users] pcolor plot question about empty horizontal strip at top From: John Hunter - 2004-12-30 02:59:55 ```>>>>> "seberino" == seberino writes: seberino> It seems if your grid has 20 rows ( different y values) seberino> of points that you won't get 20 colored horizontal seberino> strips but rather *19*. This is because we must lose seberino> one row to specify the top and/or bottom EDGE of the seberino> plot.... so XX rows means (XX-1) rows of colored seberino> squares. yep that's right, a frequent source of confusion. seberino> Please tell me if this is right but more importantly, seberino> how to most wisely remove the white horizontal strip seberino> from this pcolor plot. Well it would help if you posted your code, but my guess is that you need to set your axis limits to equal your ymin/ymax of the pcolor. Perhaps this example will give you a hint >>> pcolor(rand(10,7)) # no white strip... >>> ylim(0,11) # a white strip because the ylim is wrong In essence, the axis autoscaler will round up, eg 4990 to 5000, to make nice integer ticks. With pcolors and images, you often don't want this, so use the axis, xlim, and/or ylim commands to set the limits properly. Eg ymin = min(ravel(Y)) ymax = max(ravel(Y)) ylim(ymin, ymax) Also, if your x and y grids are equally spaced, you'll get much better performance for large arrays, as well as more interpolation options, if you use imshow with the extent kwarg to set the extent of your image data. JDH ```