I have some skymap data, i.e. theta, phi and some intensity that I
would like to plot on the surface of a sphere, does matplotlib support
plotting on the surface of a sphere? I've looked through the examples
and can't seem to find anything.
I have some skymap data, i.e. theta, phi and some intensity that I
would like to plot on the surface of a sphere, does matplotlib support
plotting on the surface of a sphere? I've looked through the examples
and can't seem to find anything.
Any help would be greatly appreciated.
Cheers
Adam
Adam: If you can convert your coordinates into latitudes and longitudes, then you can plot the data with the basemap tookit on your choice of map projection (see http://www.scipy.org/Cookbook/Matplotlib/Maps for an example).
-Jeff
···
--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory
On 09/10/2007, Jeff Whitaker <jswhit@...146...> wrote:
Adam: If you can convert your coordinates into latitudes and
longitudes, then you can plot the data with the basemap tookit on your
choice of map projection (see http://www.scipy.org/Cookbook/Matplotlib/Maps for an example).
where lat is an array of the latitude, lon the corresponding latitude
and values the value of the quantity I want to plot, this results in
the error:
Traceback (most recent call last):
File "./plot_skymap.py", line 54, in ?
map.contour(lat, lon, values)
File "/opt/local/lib/python2.4/site-packages/matplotlib/toolkits/basemap/basemap.py",
line 2484, in contour
xx = x[x.shape[0]/2,:]
IndexError: too many indices
Can anyone give me any pointers, on what the problem is here?
Cheers
Adam
···
On 09/10/2007, Jeff Whitaker <jswhit@...146...> wrote:
Adam: If you can convert your coordinates into latitudes and
longitudes, then you can plot the data with the basemap tookit on your
choice of map projection (see http://www.scipy.org/Cookbook/Matplotlib/Maps for an example).
On Tuesday 09 October 2007 20:08:29 Adam Mercer wrote:
On 09/10/2007, Jeff Whitaker <jswhit@...146...> wrote:
> Adam: If you can convert your coordinates into latitudes and
> longitudes, then you can plot the data with the basemap tookit on your
> choice of map projection (see
> http://www.scipy.org/Cookbook/Matplotlib/Maps for an example).
Following that example I'm running into a few problems, this is the code I
have:
Adam: If you can convert your coordinates into latitudes and
longitudes, then you can plot the data with the basemap tookit on your
choice of map projection (see http://www.scipy.org/Cookbook/Matplotlib/Maps for an example).
Following that example I'm running into a few problems, this is the code I have:
where lat is an array of the latitude, lon the corresponding latitude
and values the value of the quantity I want to plot, this results in
the error:
Traceback (most recent call last):
File "./plot_skymap.py", line 54, in ?
map.contour(lat, lon, values)
File "/opt/local/lib/python2.4/site-packages/matplotlib/toolkits/basemap/basemap.py",
line 2484, in contour
xx = x[x.shape[0]/2,:]
IndexError: too many indices
Can anyone give me any pointers, on what the problem is here?
Cheers
Adam
Adam: If lat and lon are 2D arrays containing the lats and lons of the grid in degrees, you first need to convert to map projection coordinates using the map instance:
x,y = map(lons, lats)
(if lons and lats are 1D, you can use pylab.meshgrid to make them 2D first)