Hi,

I have not found any documentation on plotting non regular data with

basemap *without* interpolation.

Plotting scattered data on the sphere works fine, but the size of each

point seems to be limited, so there are "holes".

Is there an option in basemap for that ?

Alexis

pcolor might be what you want (not pcolormesh()). I use it to plot radar data when there might be gaps in the coverage.

Ben Root

## ···

On Wed, Feb 1, 2012 at 9:59 AM, Alexis Praga <alexis.praga@…185…> wrote:

Hi,

I have not found any documentation on plotting non regular data with

basemap *without* interpolation.

Plotting scattered data on the sphere works fine, but the size of each

point seems to be limited, so there are “holes”.

Is there an option in basemap for that ?

Alexis

To do this you will have to bin your data into rectangular grid

boxes, filling a masked array (with the grid boxes that have no data

masked). There’s some code to this at

```
-Jeff
```

## ···

http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data

```
-- Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : 325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web :
```

Jeffrey.S.Whitaker@…259…http://tinyurl.com/5telg

and here’s an example of how to do this with the matplotlib hexbin

function…

```
from numpy.random import uniform
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.basemap import Basemap
npts = 5000
m = Basemap(lon_0=270, boundinglat=20, projection='npstere')
# create randomly distributed points in map projection coordinates
x = uniform(m.xmin,m.xmax,npts)
y = uniform(m.ymin,m.ymax,npts)
xscaled = 4.*(x-0.5*(m.xmax-m.xmin))/m.xmax
yscaled = 4.*(y-0.5*(m.ymax-m.ymin))/m.ymax
# z is the data to plot at those points.
z = xscaled*np.exp(-xscaled**2-yscaled**2)
CS = plt.hexbin(x,y,C=z,gridsize=50,cmap=plt.cm.jet)
m.drawcoastlines()
m.drawparallels(np.arange(0,81,20))
m.drawmeridians(np.arange(-180,181,60))
m.colorbar() # draw colorbar
plt.show()
-Jeff
```

## ···

http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data

```
-- Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : 325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web :
```

Jeffrey.S.Whitaker@…259…http://tinyurl.com/5telg