Skip to main content

Legendgrams

This is a small bit of unittested, reproducible code to provide legendgrams. Legendgrams are map legends that visualize the distribution of observations by color in a given map:

Silhouettes in Brooklyn

Legendgrams are distributed by PySAL, an open source cross-platform library of spatial analysis functions written in Python. It is intended to support the development of high level applications for spatial analysis.

To use legendgrams, simply install the package using pip:

$ pip install legendgram

Then, apply the function to the figure/axis you want to have a legendgram:

>>> import pysal as ps, geopandas as gpd, matplotlib.pyplot as plt
>>> from legendgram import legendgram
>>> data = gpd.read_file(ps.examples.get_path('south.shp'))
>>> data.crs = {'init': 'epgs:4269'}
>>> data.to_crs(epsg=5070)
>>> f,ax = plt.subplots()
>>> data.plot('DV80', k=10, ax=ax, scheme='Quantiles')
>>> bins = ps.Quantiles(data['DV80'].values, k=10).bins
>>> from legendgram import legendgram
>>> import palettable.matplotlib as palmpl
>>> legendgram(f,ax,data['DV80'],bins,pal=palmpl.Viridis_10,
               legend_size=(.5,.2), # legend size in fractions of the axis
               loc = 'upper left' # matplotlib-style legend locations
               clip = (2,10) # clip the displayed range of the histogram
               )
Example legendgram map in the US south

An example notebook is provided as well.

License

This is licensed under the 3-Clause BSD license. Refer to the license file for more details.

Metadata

Release files for legendgram 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for legendgram 0.0.3
File Size Uploaded Provenance
legendgram-0.0.3.tar.gz 683.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for legendgram 0.0.3
File Interpreter ABI Platform
legendgram-0.0.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 691.6 kB

Release files / legendgram-0.0.3.tar.gz

Download URL legendgram-0.0.3.tar.gz
Size 683.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1345a2191323d38b210470177435c9292a21e5dd2449f327179e29413772a9fa
BLAKE2b-256 checksum
How to use checksums
561e28596cbe4bb73727ba59d1cf63f2ad69799a308840c6a3fd4d214111e26c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / legendgram-0.0.3-py2.py3-none-any.whl

Download URL legendgram-0.0.3-py2.py3-none-any.whl
Size 7.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
71932cabca43434c3667e4f0c66dcde139ae5dfcdff3863845980b6f1278b711
BLAKE2b-256 checksum
How to use checksums
90298a03d693d26f6fc4476953c7a639f978836b47b49635447b80201b522c58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for legendgram 0.0.3

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.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page