{"id":4928,"library":"descartes","title":"Descartes","description":"Descartes is a Python library that enables the use of geometric objects, typically from the Shapely library, as Matplotlib paths and patches. It provides a convenient way to integrate vector geometries into Matplotlib plots. The current version is 1.1.0, released on January 17, 2017. Due to its last release date, the project has a very slow or effectively ceased release cadence, leading to compatibility challenges with newer dependencies.","status":"deprecated","version":"1.1.0","language":"en","source_language":"en","source_url":"https://github.com/benjimin/descartes","tags":["matplotlib","gis","geometry","shapely","plotting","patches","vector graphics","geospatial"],"install":[{"cmd":"pip install descartes","lang":"bash","label":"Install Descartes"}],"dependencies":[{"reason":"Required for plotting geometric objects.","package":"matplotlib","optional":false},{"reason":"Underlying dependency for array operations.","package":"numpy","optional":false},{"reason":"Highly recommended for creating geometric objects that Descartes plots. Version <2.0 is required for full compatibility with descartes 1.1.0.","package":"Shapely","optional":true}],"imports":[{"symbol":"PolygonPatch","correct":"from descartes import PolygonPatch"},{"note":"While `descartes.patch` might work, the direct `descartes` import is the common and intended pattern.","wrong":"from descartes.patch import PointPatch","symbol":"PointPatch","correct":"from descartes import PointPatch"},{"symbol":"LineStringPatch","correct":"from descartes import LineStringPatch"}],"quickstart":{"code":"import matplotlib.pyplot as plt\nfrom shapely.geometry import Polygon\nfrom descartes import PolygonPatch\n\n# Define a simple polygon using Shapely\npolygon = Polygon([(0, 0), (1, 1), (0, 1), (0, 0)])\n\n# Create a Matplotlib figure and axes\nfig, ax = plt.subplots()\n\n# Create a PolygonPatch from the Shapely Polygon\n# You can customize color (fc), edge color (ec), alpha, etc.\npatch = PolygonPatch(polygon, fc='blue', ec='black', alpha=0.5, zorder=2)\n\n# Add the patch to the axes\nax.add_patch(patch)\n\n# Set axes limits to display the polygon\nminx, miny, maxx, maxy = polygon.bounds\nax.set_xlim(minx - 0.1, maxx + 0.1)\nax.set_ylim(miny - 0.1, maxy + 0.1)\nax.set_aspect('equal', adjustable='box') # Keep aspect ratio\n\nplt.title(\"Shapely Polygon plotted with Descartes\")\nplt.show()","lang":"python","description":"This quickstart demonstrates how to create a `shapely.geometry.Polygon` and then render it on a Matplotlib axis using `descartes.PolygonPatch`. The `PolygonPatch` converts the geometric object into a displayable Matplotlib patch."},"warnings":[{"fix":"Downgrade Shapely to a version less than 2.0 (e.g., `pip install 'Shapely<2.0'`) or consider migrating to a different plotting solution that natively supports newer Shapely versions, such as `matplotlib.patches.Polygon` directly, or libraries like GeoPandas (which has dropped descartes as a dependency).","message":"Descartes 1.1.0 is incompatible with Shapely versions 2.0 and newer. Using `PolygonPatch` (or other patches) with `Shapely >= 2.0` will result in an `IndexError: too many indices for array` due to changes in how Shapely exposes exterior/interior coordinates.","severity":"breaking","affected_versions":"descartes 1.1.0 with Shapely >= 2.0"},{"fix":"Be aware of potential compatibility issues. For new projects, consider using native Matplotlib patching capabilities with Shapely geometries or explore other maintained geospatial plotting libraries.","message":"The Descartes library is no longer actively maintained; its last release was in January 2017. This means it will not receive updates for new features, bug fixes, or official compatibility with newer versions of Python or its dependencies (like Matplotlib or Shapely). Other libraries that previously relied on Descartes are migrating away from it.","severity":"deprecated","affected_versions":"All versions, especially when used with modern Python environments (Python 3.8+)."},{"fix":"Plan for additional libraries for advanced geospatial plotting. Understand that Descartes primarily acts as a bridge between Shapely geometries and Matplotlib patches.","message":"While Descartes handles basic geometric objects, for more complex GIS plotting needs (e.g., coordinate system transformations, basemaps), you will likely need to integrate it with other libraries like Matplotlib's Basemap or GeoPandas (though GeoPandas is moving away from Descartes).","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}