TO DO NEXT: Try last effort(described below) at making quartile legend. If that fails put the ugly-code matplotlib legend solution back in (it's hiding in the "copy". To do: Map Tiles Scale ?side by side maps point people towards the folium examples on github Clean up code and what not Write an intro (that includes the fact i'm looking for a job outside of teaching ASAP (but in portland):p) Write prose to explain any complicated bit Write conclusion about limitations ?Figure out how to deal with massive file sizes Figure out how to get it to the web for sharing
In [96]:
#Collin Reinking
#[email protected]

import folium
%matplotlib inline
import pandas as pd
import re
import os
import branca.colormap as cm
import re
import numpy as np
#import matplotlib as mpl
#import matplotlib.pyplot as plt
#from matplotlib import colors
#from scipy import stats


# Simple Dot Plot On Map¶

In [2]:
data = pd.read_pickle('data/listings_cleaned.pkl')
data = pd.DataFrame(data, columns = ['latitude','longitude']) #[:50]  <-this kind of slice is useful for developing a map

Out[2]:
latitude longitude
listing_id
5794291 45.533373 -122.648236
15358320 45.532048 -122.641223
15164536 45.533932 -122.647206
6106997 45.534491 -122.646883
5134256 45.533274 -122.646870
In [3]:
#create a map
this_map = folium.Map(prefer_canvas=True)

def plotDot(point):
'''input: series that contains a numeric named latitude and a numeric named longitude
folium.CircleMarker(location=[point.latitude, point.longitude],

#use df.apply(,axis=1) to iterate through every row in your dataframe
data.apply(plotDot, axis = 1)

#Set the zoom to the maximum possible
this_map.fit_bounds(this_map.get_bounds())

#Save the map to an HTML file
#this_map.save(os.path.join('html_map_output/simple_dot_plot.html'))

this_map

Out[3]: