Skip to content

Gavsum/shopifySales

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Shopify Choropleth Map

Simple choropleth map rendering using Matplotlib and Basemap.

Installation

I will assume you already have pip & python 2.7 installed

  • make a project directory wherever you would like
  • Make a virtualenv (recomended but not required), and install requirements with pip
mkvirutalenv shopify
pip install matplotlib
pip install fiona
pip install shapely
pip install descartes
pip install pysal
pip install lxml
pip install pandas
  • Installing basemap (not so fun part)
wget -O basemap.tar.gz http://downloads.sourceforge.net/project/matplotlib/matplotlib-toolkits/basemap-1.0.7/basemap-1.0.7.tar.gz?r=&ts=1484241851&use_mirror=superb-dca2
  • Extract files
tar -xvzf basemap.tar.gz
  • Install Geod 3.3.3 and install
cd basemap-1.0.7/
cd geos-3.3.3/
# Recomend home directory to avoid permissions issues in /usr/local
export GEOS_DIR=<wherever you want the libs to go>
./configure --prefix=$GEOS_DIR
make; make install
cd ..
python setup.py install
  • Test that basemap is installed by running python or ipython and importing
>>> mpl_toolkits.basemap import Basemap
  • Clean up
rm basemap.tar.gz
sudo rm -R basemap-1.0.7/

Choropleth program should now be ready to go!

Usage

Running the python file will create a semi interactive choropleth as well as save a png of the map to that data/ dir

python shopifySales.py

TODO

  • Calculate translation on Map data and sales data localized in Alaska or Hawaii to move both the rendered states and associated sales points below the main rendering to represent all data within the frame

and or

  • Create Shapefile or geojson file that includes Canada in mapping (Seems difficult to combine shapefiles without consistent file formatting from a single resource)
  • Modify Density calculations and labels to display based on dollar values instead of # of orders
  • Add mouse over info per state (eg: Sales in $ value)

Alt text

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages