Skip to main content

Legendgrams are map legends that visualize the distribution of observations by color in a given map

Project description


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:

.. image:: https://raw.githubusercontent.com/pysal/legendgram/master/figs/brooklyn.png
:width: 40%
:height: 200px
:scale: 50%
:alt: Silhouettes in Brooklyn

PySAL_ is 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:

.. code-block:: bash

$ pip install pysal

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

.. code-block:: python

>>> import pysal as ps, geopandas as gpd, matplotlib.pyplot as plt
>>> 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, cmap='inferno', ax=ax, scheme='Quantiles')
>>> bins = ps.Quantiles(data['DV80'].values).bins
>>> from legendgram import legendgram
>>> import palettable.matplotlib as palmpl
>>> legendgram(f,ax,data['DV80'],bins,pal=palmpl.Inferno_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
)

.. image:: https://raw.githubusercontent.com/pysal/legendgram/master/figs/example.png
:width: 100%
:alt: Example legendgram map in the US south


License
-------

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

legendgram-0.0.2.tar.gz (683.6 kB view details)

Uploaded Source

Built Distribution

legendgram-0.0.2-py2.py3-none-any.whl (7.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file legendgram-0.0.2.tar.gz.

File metadata

  • Download URL: legendgram-0.0.2.tar.gz
  • Upload date:
  • Size: 683.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for legendgram-0.0.2.tar.gz
Algorithm Hash digest
SHA256 96e21fa62e45b97b984a5a9c18b19b3e421913bc310c8fa05442d03a54404e4e
MD5 e83b765b678683fafde97e5b06b396c6
BLAKE2b-256 e8a59fc6be1479cb8be54b33488de91f44eb54976cbc978ceb9c07c968fd831b

See more details on using hashes here.

Provenance

File details

Details for the file legendgram-0.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for legendgram-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1fd4c316ef8cf19157f11d43129f1d7d594c7dbf1ae490ec4cc3b0c5ec21e278
MD5 63d4feedf5ce659c51b435c2f90380f6
BLAKE2b-256 1a68bcf8cd53f0ae6d9532206c4cb6546f02d11f2a36350c5a9d45880a6127f9

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page