In [2]:
%matplotlib inline

In [3]:
import matplotlib.pyplot as plt
import matplotlib.tri as tri
import cartopy.crs as ccrs
from cartopy.io.img_tiles import MapQuestOpenAerial

In [4]:
import numpy as np
x = -70.5 + np.random.rand(1000)
y = 42 + np.random.rand(1000)

triang = tri.Triangulation(x,y)

In [5]:
geodetic = ccrs.Geodetic(globe=ccrs.Globe(datum='WGS84'))

fig = plt.figure(figsize=(12,8))
tiler = MapQuestOpenAerial()
ax = plt.axes(projection=tiler.crs)

bbox=[-71, -69.3, 42, 42.8]
#ax = plt.axes(projection=ccrs.PlateCarree())
ax.set_extent(bbox)
ax.add_image(tiler, 8)

#ax.coastlines()
kw = dict(marker='.', linestyle='-', alpha=0.85, color='darkgray', transform=geodetic)
ax.triplot(triang, **kw)  # or lon, lat, triangules
#ax.set_extent()
gl = ax.gridlines(draw_labels=True)
gl.xlabels_top = False
gl.ylabels_right = False


/home/usgs/miniconda/envs/ioos/lib/python2.7/site-packages/matplotlib/tri/triangulation.py:110: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  self._neighbors)
/home/usgs/miniconda/envs/ioos/lib/python2.7/site-packages/numpy/lib/shape_base.py:431: FutureWarning: in the future np.array_split will retain the shape of arrays with a zero size, instead of replacing them by `array([])`, which always has a shape of (0,).
  FutureWarning)
/home/usgs/miniconda/envs/ioos/lib/python2.7/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if self._edgecolors == str('face'):

In [6]:
plt.triplot(triang)


Out[6]:
[<matplotlib.lines.Line2D at 0x7fc8b7cf29d0>,
 <matplotlib.lines.Line2D at 0x7fc8b7cf2a90>]

In [ ]: