-
Notifications
You must be signed in to change notification settings - Fork 256
GoogleMapPlotter.scatter
GoogleMapPlotter.scatter(lats, lngs, color=None, size=None, marker=True, c=None, s=None, symbol='o', **kwargs)
Plot a collection of points.
-
Parameters
-
lats
[float]– Latitudes. -
lngs
[float]– Longitudes.
-
-
Optional Parameters
-
color/c/edge_color/ec
stror[str]– Color of each point. Can be hex (‘#00FFFF’), named (‘cyan’), or matplotlib-like (‘c’). Defaults to black. -
size/s
intor[int]– Size of each point, in meters (symbols only). Defaults to 40. -
marker
boolor[bool]– True to plot points as markers, False to plot them as symbols. Defaults to True. -
symbol
stror[str]– Shape of each point, as ‘o’, ‘x’, or ‘+’ (symbols only). Defaults to ‘o’. -
title
stror[str]– Hover-over title of each point (markers only). -
label
stror[str]– Label displayed on each point (markers only). -
precision
intor[int]– Number of digits after the decimal to round to for lat/lng values. Defaults to 6. -
alpha/face_alpha/fa
floator[float]– Opacity of each point’s face, ranging from 0 to 1 (symbols only). Defaults to 0.3. -
alpha/edge_alpha/ea
floator[float]– Opacity of each point’s edge, ranging from 0 to 1 (symbols only). Defaults to 1.0. -
edge_width/ew
intor[int]– Width of each point’s edge, in pixels (symbols only). Defaults to 1.
-
Usage:
import gmplot
apikey = '' # (your API key here)
gmap = gmplot.GoogleMapPlotter(37.766956, -122.479481, 15, apikey=apikey)
attractions = zip(*[
(37.769901, -122.498331),
(37.768645, -122.475328),
(37.771478, -122.468677),
(37.769867, -122.466102),
(37.767187, -122.467496),
(37.770104, -122.470436)
])
gmap.scatter(
*attractions,
color=['red', 'orange', 'yellow', 'green', 'blue', 'purple'],
s=60,
ew=2,
marker=[True, True, False, True, False, False],
symbol=[None, None, 'o', None, 'x', '+'],
title=['First', 'Second', None, 'Third', None, None],
label=['A', 'B', 'C', 'D', 'E', 'F']
)
gmap.draw('map.html')