This project has been archived by its maintainers, and is no longer receiving any updates.
Descartes
Use Shapely or GeoJSON-like geometric objects as matplotlib paths and patches
Requires: matplotlib, numpy, and optionally Shapely 1.2+.
Example:
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)
pyplot.show()
See also: examples/patches.py.
Descartes is not associated with the identically named and apparently defunct project at http://descartes.sourceforge.net/.
Metadata
Release files for descartes 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| descartes-1.1.0.tar.gz | 3.5 kB | Without provenance | Details for descartes-1.1.0.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| descartes-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for descartes-1.1.0-py3-none-any.whl |
| descartes-1.1.0-py2-none-any.whl | Python 2 | none | any | Details for descartes-1.1.0-py2-none-any.whl |
Total release size: 15.1 kB
Release files / descartes-1.1.0.tar.gz
| Download URL | descartes-1.1.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
135a502146af5ed6ff359975e2ebc5fa4b71b5432c355c2cafdc6dea1337035b
|
|
BLAKE2b-256 checksum How to use checksums |
1d6f81735a30432b74f41db6754dd13869021ccfed3088d1cf7a6cfc0af9ac49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / descartes-1.1.0-py3-none-any.whl
| Download URL | descartes-1.1.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c62dc41109689d03e4b35de0a2bcbdeeb81047badc607c4415d5c753bd683af
|
|
BLAKE2b-256 checksum How to use checksums |
e5b61ed2eb03989ae574584664985367ba70cd9cf8b32ee8cad0e8aaeac819f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / descartes-1.1.0-py2-none-any.whl
| Download URL | descartes-1.1.0-py2-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
b7e412e7e6e294412f1d0f661f187babc970088c2456089e6801eebb043c2e1b
|
|
BLAKE2b-256 checksum How to use checksums |
e729b23b57c92a1cf58da25070c10cab90fb38de22523ef7bdc76acdad717645
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for descartes 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.