Re: [Matplotlib-users] luminocity plot on hammer projection

2008-10-06 Thread Michael Droettboom
imshow always assumes a regular rectangular grid of pixels.  To plot 
image data on a non-rectilinear projection, you need to use pcolor or 
pcolormesh.

You may also want to look at the basemap toolkit, which provides much 
better support for geographic projections.  The ones included in 
matplotlib are essentially "toy" examples to test the infrastructure, 
but aren't really intended for advanced usage.

Cheers,
Mike

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)
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


-
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


Re: [Matplotlib-users] luminocity plot on hammer projection

2008-10-06 Thread Jeff Whitaker
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/PSD1FAX   : (303)497-6449
325 BroadwayBoulder, 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


Re: [Matplotlib-users] luminocity plot on hammer projection

2008-10-05 Thread Eric Firing
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

-
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


[Matplotlib-users] luminocity plot on hammer projection

2008-10-05 Thread dasratsel

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)
-- 
View this message in context: 
http://www.nabble.com/luminocity-plot-on-hammer-projection-tp19829899p19829899.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


-
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