In [1]:
from datascience import *
In [2]:
Map()
Out[2]:
In [3]:
Map(zoom_start=16)
Out[3]:
In [4]:
Marker(37.78, -122.42, 'San Francisco')
Out[4]:
In [5]:
m = Marker(37.78, -122.42, 'San Francisco', color='green')
m.show()
Marker(37.78, -122.42, 'San Francisco').format(marker_icon='thumbs-up').show()
m
Out[5]:
In [6]:
# Test different tile styles
Map(tiles='Stamen Toner').show()
Map(tiles='Stamen Terrain')
Out[6]:
In [7]:
features = [
Marker(51.5135015, -0.1358392, 'A'),
Marker(51.5137, -0.1358392, 'B'),
Marker(51.5132, -0.138, 'C'),
Marker(51.5143, -0.135, 'D')
]
Map(features)
Out[7]:
In [8]:
Map(features, zoom_start=15)
Out[8]:
In [9]:
points = [
(51.5135015, -0.1358392),
(51.5137, -0.1358392),
(51.5132, -0.138),
(51.5143, -0.135),
]
lats, lons = zip(*points)
Marker.map(lats, lons, ['A', 'B', 'C', 'D'], color='black')
Out[9]:
In [10]:
colors = ['red', 'blue', 'gray', 'green']
icons = ['thumbs-up', 'info-sign', 'thumbs-up', 'info-sign']
t = Table().with_columns(*zip(['lat', 'lon', 'labels', 'color', 'marker_icon'], [lats, lons, colors, colors, icons]))
t.show()
Marker.map_table(t)
Out[10]:
In [11]:
colors = ['red', 'blue', 'yellow', 'green']
Circle.map(lats, lons, colors=colors, fill_opacity=0.8, radius=20)
Out[11]:
In [12]:
names = colors
t = Table().with_columns(*zip(['lat', 'lon', 'name', 'color'], [lats, lons, names, colors]))
t.show()
Circle.map_table(t, radius=20)
Out[12]:
In [13]:
states = Map.read_geojson('us-states.json')
states
Out[13]:
In [14]:
Map([states['CA'], states['NV'].format(color='yellow')])
Out[14]:
In [15]:
# Reading in GeoJSON from link
url = "https://raw.githubusercontent.com/python-visualization/folium/master/examples/data/world-countries.json"
Map.read_geojson(url)
Out[15]:
In [16]:
from datascience import *
In [17]:
unemployment = Table.read_table('us-unemployment.csv')
unemployment
Out[17]:
In [18]:
states.color(unemployment)
Out[18]:
In [19]:
Table().with_columns(
'State', states.keys(),
'Region', states.values()).show(3)
In [ ]: