Eric Firing wrote: > dasratsel wrote: > >> Hi, >> >> I've done some poking an I can't find a way to use imshow() to plot a >> luminosity map on a hammer projection. (looking to generate a plot like >> http://en.wikipedia.org/wiki/Image:WMAP_2008.png). Just setting the >> projection in a call to subplot gives some axes and an off-center retangular >> image of my array. Bearing in mind that I am completely new to matplotlib, >> does anyone have an idea of how to get this sort of plot? >> >> Thanks, >> Kris >> >> (PS. Apologies if this shows up in two places, I'm not used to using mailing >> lists) >> > > Kris, > > For any sort of mapping like this, you will probably want to use basemap > matplotlib toolkit, except that I don't see "hammer" among the supported > projections. > > With straight mpl, imshow does not support projections. You could use > pcolor (very slow) or pcolormesh. In neither case will you get > interpolation; you will be specifying colored quadrilaterals. > > Eric > > > Kris: Basemap does not support the 'hammer' projection, but it does have mollweide, which is very similar. Something like this ought to do it:
from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt # lon_0 is the center longitude of the data. map = Basemap(projection='moll',lon_0=180) # lons, lats are the longitudes and latitudes of the data # lons.shape, lats.shape = data.shape x, y = map(lons,lats) # make a filled mesh plot. im = map.pcolormesh(x,y,data,cmap=plt.cm.jet) # draw a boundary around the map map.drawmapboundary() plt.show() -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 the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users