In [2]:
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import pandas as pd
import gmaps
import json
import os
%matplotlib inline
In [3]:
with open('secrets.json') as secrets_file:
secrets = json.load(secrets_file)
len(secrets)
Out[3]:
In [4]:
gmaps.configure(api_key=secrets['GMAPS_API_KEY'])
In [53]:
plt.rcParams['figure.figsize'] = (5,5)
In [9]:
stations = pd.read_csv('data/stations_combined.csv', index_col=0)
stations.head(5)
Out[9]:
In [10]:
stations.describe()
Out[10]:
In [11]:
fig = plt.figure(figsize=(18,16))
plt.scatter(stations['latitude'], stations['longitude'])
plt.show()
In [58]:
# m = Basemap(projection='ortho', lat_0=37.430980, lon_0=-122.143135)
# lower left = (37.166, -122.843)
# upper right = (37.859, -121.598)
fig=plt.figure(figsize=(18, 16))
m = Basemap(llcrnrlon=-122.843, llcrnrlat=37.166, urcrnrlon=-121.598, urcrnrlat=37.859,
projection='lcc',lat_0=37.430980,lon_0=-122.143135,
resolution ='h')
m.fillcontinents(color='tan')
plt.show()
In [16]:
stations_coords = list(zip(stations['latitude'], stations['longitude']))
In [20]:
bay_area_coordinates = (37.430980, -122.143135)
# fig = gmaps.figure(center=bay_area_coordinates, zoom_level=10)
fig = gmaps.figure()
markers = gmaps.marker_layer(stations_coords)
fig.add_layer(markers)
fig
In [28]:
m = gmaps.Map(width="1000px", height="1000px")
markers = gmaps.marker_layer(stations_coords)
m.add_layer(markers)
m
In [ ]: