Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

pypm install descartes

How to install descartes

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install descartes
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
1.0 Available View build log
Windows (64-bit)
1.0 Available View build log
Mac OS X (10.5+)
1.0 Available View build log
Linux (32-bit)
1.0 Available View build log
Linux (64-bit)
1.0 Available View build log
Depended by
Lastest release
version 1.0 on Jan 5th, 2011

Use Shapely or GeoJSON-like geometric objects as matplotlib paths and patches


System Message: WARNING/2 (<string>, line 7)

Explicit markup ends without a blank line; unexpected unindent.

Requires: matplotlib, numpy, and optionally Shapely 1.2.


System Message: WARNING/2 (<string>, line 14)

Literal block expected; none found.

from matplotlib import pyplot from shapely.geometry import LineString from descartes import PolygonPatch

BLUE = '#6699cc' GRAY = '#999999'

def plot_line(ax, ob): x, y = ob.xy ax.plot(x, y, color=GRAY, linewidth=3, solid_capstyle='round', zorder=1)

line = LineString([(0, 0), (1, 1), (0, 2), (2, 2), (3, 1), (1, 0)])

fig = pyplot.figure(1, figsize=(10, 4), dpi=180)

# 1 ax = fig.add_subplot(121)

plot_line(ax, line)

dilated = line.buffer(0.5) patch1 = PolygonPatch(dilated, fc=BLUE, ec=BLUE, alpha=0.5, zorder=2) ax.add_patch(patch1)

#2 ax = fig.add_subplot(122)

patch2a = PolygonPatch(dilated, fc=GRAY, ec=GRAY, alpha=0.5, zorder=1) ax.add_patch(patch2a)

eroded = dilated.buffer(-0.3)

# GeoJSON-like data works as well

polygon = eroded.__geo_interface__ # >>> geo['type'] # 'Polygon' # >>> geo['coordinates'][0][:2] # ((0.50502525316941682, 0.78786796564403572), (0.5247963548222736, 0.8096820147509064)) patch2b = PolygonPatch(polygon, fc=BLUE, ec=BLUE, alpha=0.5, zorder=2) ax.add_patch(patch2b)


See also: examples/patches.py.

Descartes is not associated with the identically named and apparently defunct project at http://descartes.sourceforge.net/.

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:3

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.