Listers,

I'm using basemap to plot randomly sampled values (x,y,z) through hexbin.  This 
produces a very nice result. Some sample code is:
----------
import numpy as np
from numpy.random import seed
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from matplotlib.mlab import griddata

ll_lat = -38.39477  # extent of area of interest
ll_lon = 144.54767
ur_lat = -37.51642
ur_lon = 145.67144

num_points = 100    # sample points

# create random sampling over the area of interest
seed(0)
data = np.ones((3, num_points))
data[0,:] *= ll_lon + np.random.random((num_points))*(ur_lon-ll_lon)
data[1,:] *= ll_lat + np.random.random((num_points))*(ur_lat-ll_lat)
data[2,:] *= np.random.random((num_points))*10000

# plot the data
fig = plt.figure()
ax = fig.add_subplot(111)
m = Basemap(projection='cyl', llcrnrlat=ll_lat, urcrnrlat=ur_lat,
            llcrnrlon=ll_lon, urcrnrlon=ur_lon, resolution='f',
            suppress_ticks=False, area_thresh=0.5)
plt.hexbin(data[0,:], data[1,:], data[2,:], zorder=3)
m.fillcontinents(color=(0.8,0.8,0.8,0), zorder=1)
m.drawcoastlines(linewidth=0.25, color='k', zorder=2)
plt.show()
----------

This contrived example shows a sparse set of hexagons on both land and ocean.  
I would like the hexagons over the ocean to be hidden.  I can make the ones on 
land disappear by changing the 'zorder' parameter of .hexbin() to 0.  However I 
have found no way of doing the inverse and hiding hexagons over the ocean.

Using drawlsmask() is too crude at a 5-minute resolution.

Any ideas?

Thanks,
Ross

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to