Tommy Grav wrote: > Thanks for pointing this function out. I thought I had look for it, > but must have overlooked it. > > I am using the test code below, but the array is plotted outside the > boundary of the map. Is there > a way to avoid this? > > Cheers > Tommy > > from math import * > from matplotlib.toolkits.basemap import Basemap > import pylab > import numpy > > rabins = numpy.arange(0.,360.,6) > decbins = numpy.arange(-90.,90.,6) > map = Basemap(projection="sinu",lat_0=0.,lon_0=180.,rsphere=1.) > > coverage = numpy.zeros([len(decbins),len(rabins)],"int") > > coverage[0:5,:] = 2 > coverage[5:10,:] = 4 > > > map.imshow(coverage,interpolation="nearest",cmap=pylab.cm.hot_r) > map.drawmapboundary() > > pylab.show() > > > > > On Mar 6, 2008, at 11:10 AM, Jeff Whitaker wrote: > > >> Tommy Grav wrote: >> >>> Is there a way of using imshow together with a basemap? >>> >>> Cheers >>> Tommy >>> >>> >> Tommy: >> >> Use the imshow basemap method, just as you would the pylab version. >> >> -Jeff >> >>
Tommy: You're using a non-rectangular map projection, so imshow won't work. Try pcolor or pcolormesh instead, i.e. replace map.imshow with: rabins, decbins = numpy.meshgrid(rabins, decbins) x,y = map(rabins,decbins) map.pcolor(x,y,coverage,cmap=pylab.cm.hot_r) -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328 ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users