1Metadata-Version: 1.1 2Name: descartes 3Version: 1.1.0 4Summary: Use geometric objects as matplotlib paths and patches 5Home-page: http://bitbucket.org/sgillies/descartes/ 6Author: Sean Gillies 7Author-email: sean.gillies@gmail.com 8License: BSD 9Description: Descartes 10 ========= 11 12 Use Shapely_ or GeoJSON-like geometric objects as matplotlib paths and patches 13 14 .. image:: http://farm4.static.flickr.com/3662/4555372019_9bbed1f956_o_d.png 15 :width: 800 16 :height: 320 17 18 Requires: matplotlib, numpy, and optionally Shapely 1.2+. 19 20 Example:: 21 22 from matplotlib import pyplot 23 from shapely.geometry import LineString 24 from descartes import PolygonPatch 25 26 BLUE = '#6699cc' 27 GRAY = '#999999' 28 29 def plot_line(ax, ob): 30 x, y = ob.xy 31 ax.plot(x, y, color=GRAY, linewidth=3, solid_capstyle='round', zorder=1) 32 33 line = LineString([(0, 0), (1, 1), (0, 2), (2, 2), (3, 1), (1, 0)]) 34 35 fig = pyplot.figure(1, figsize=(10, 4), dpi=180) 36 37 # 1 38 ax = fig.add_subplot(121) 39 40 plot_line(ax, line) 41 42 dilated = line.buffer(0.5) 43 patch1 = PolygonPatch(dilated, fc=BLUE, ec=BLUE, alpha=0.5, zorder=2) 44 ax.add_patch(patch1) 45 46 #2 47 ax = fig.add_subplot(122) 48 49 patch2a = PolygonPatch(dilated, fc=GRAY, ec=GRAY, alpha=0.5, zorder=1) 50 ax.add_patch(patch2a) 51 52 eroded = dilated.buffer(-0.3) 53 54 # GeoJSON-like data works as well 55 56 polygon = eroded.__geo_interface__ 57 # >>> geo['type'] 58 # 'Polygon' 59 # >>> geo['coordinates'][0][:2] 60 # ((0.50502525316941682, 0.78786796564403572), (0.5247963548222736, 0.8096820147509064)) 61 patch2b = PolygonPatch(polygon, fc=BLUE, ec=BLUE, alpha=0.5, zorder=2) 62 ax.add_patch(patch2b) 63 64 pyplot.show() 65 66 67 See also: examples/patches.py. 68 69 Descartes is not associated with the identically named and apparently defunct 70 project at http://descartes.sourceforge.net/. 71 72 .. _Shapely: http://gispython.org/lab/wiki/Shapely 73 74 75Keywords: matplotlib gis geojson geometry 76Platform: UNKNOWN 77Classifier: Development Status :: 5 - Production/Stable 78Classifier: Intended Audience :: Developers 79Classifier: Intended Audience :: Science/Research 80Classifier: License :: OSI Approved :: BSD License 81Classifier: Operating System :: OS Independent 82Classifier: Programming Language :: Python 83Classifier: Programming Language :: Python :: 2 84Classifier: Programming Language :: Python :: 3 85Classifier: Topic :: Scientific/Engineering :: GIS 86