Skip to main content

Bivariate Choropleth plotting library

Project description

bivariate_choropleth

Usage

Installation

Install latest from the GitHub repository:

$ pip install git+https://github.com/Parkes2/bivariate_choropleth.git

or from conda

$ conda install -c Parkes2 bivariate_choropleth

or from pypi

$ pip install bivariate_choropleth

Documentation

Documentation can be found hosted on this GitHub repository’s pages. Additionally you can find package manager specific guidelines on conda and pypi respectively.

How to use

Choose a palette for your legend

default GridPalette is a 3x3 grid with the blues2reds palette.

Use GridPalette.from_dropdown to get an interactive widget with the premade palettes. See nbs/01_grid_palette for more options for selecting grid palettes

gp = BivariateGridPalette.from_dropdown()
interactive(children=(Dropdown(description='name', options=('blues2reds', 'purple2gold', 'purple2cyan', 'green…

An example using a geodatasets dataset

import geodatasets
geodatasets.data.geoda.atlanta.url
'https://geodacenter.github.io/data-and-lab//data/atlanta_hom.zip'

bivariate_choropleth.shapefiles has some functions for using

from bivariate_choropleth.shapefiles import *

use download_and_unzip to download from the url above. The directory and filename are entered as separate arguments

download_and_unzip(r"https://geodacenter.github.io/data-and-lab//data/",'atlanta_hom.zip')
atlanta_hom.zip already exists, do you want to overwrite y/n? n

calling load_gdf() with no arguments will show a list of folders in the location of SHAPE_FILES_PATH (User/Documents/SHP_FILES)

load_gdf()
Available shapefiles are:  atlanta_hom atlanta_hom LSOA_2021_BOUNDARIES_V4 ca_state ca_counties ca_places
atlanta = load_gdf('atlanta_hom')
from bivariate_choropleth.plotting import *

call plot_bivariate_choropleth(gdf, x_col_name, y_col_name) to plot a bivariate choropleth

ax, cax = plot_bivariate_choropleth(atlanta, x='PE87', y='HR8995')

the grid_size can be changed if you want more ranks in your data.

ax, cax is returned so that the plot can be manipulated

ax, cax = plot_bivariate_choropleth(atlanta, x='PE87', y='HR8995', grid_size=5, palette_name='purple2gold')
ax.set_title('Police Expenditure and Homicide Rates in Atlanta Counties')
ax.set_axis_off()
cax.set_xlabel('Police Expenditure 1987', fontsize=5)
cax.set_ylabel('Homicide Rate 89-95', fontsize=5);

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

bivariate_choropleth-0.0.1.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bivariate_choropleth-0.0.1-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file bivariate_choropleth-0.0.1.tar.gz.

File metadata

  • Download URL: bivariate_choropleth-0.0.1.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for bivariate_choropleth-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0b4ce5fc9d260b3c701394497fb0c937586ef7ad2f00ae4d633bc3488244bc27
MD5 77aff75f0be739f2dda3bc02ce4b0288
BLAKE2b-256 bb9e3e6b52cce93e3aaff41ef10497dd0c6b574a061b3d2adb357f0198b04602

See more details on using hashes here.

File details

Details for the file bivariate_choropleth-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bivariate_choropleth-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 51aa9d77291741ad878c46e90d8bf7acf4570144864a585f9cddb1ff826d971e
MD5 02e74eec5d6b6f75f2faa2258449b96d
BLAKE2b-256 2f74baa276f9053f15ee16bf546e63dce604b377319b57c49d82987dbf46c80e

See more details on using hashes here.

Supported by

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