@@ -126,7 +126,6 @@ def get_coordinates_cities(cities, states = [""], countries = ["US"]):
126126 city_db ["%s, %s, %s" % (city .lower (), state .lower (), country .lower ())] = (lat ,lon )
127127 with open (local_db_file , "w" ) as f :
128128 json .dump (city_db , f , indent = 1 )
129-
130129
131130 return lons , lats
132131
@@ -138,7 +137,7 @@ def get_crnr_coordinates(region = "world"):
138137 if region == "world" :
139138 llcrnrlon = - 180
140139 urcrnrlon = 180
141- # Drawing the lats from -80 to 80 because mercator projection blows up
140+ # Drawing the lats from -80 to 80 because mercator projection singular
142141 # at 90
143142 urcrnrlat = 80
144143 llcrnrlat = - 80
@@ -188,7 +187,9 @@ def explore_basemap_proj(region = "world", center = (30, -98),
188187 Center of the map. Used for conical and pseudocylindrical projections.
189188 resolution: string.
190189 resolution of the continent and country boundaries. "c" for "crude", "l"
191- for "low", "i" for "intermediate".
190+ for "low", "i" for "intermediate". If the basemap_ld egg is installed,
191+ the 'h' and 'f' resolutions can be requested.
192+ WARNING: this is much SLOWER to bring up.
192193 style: string.
193194 Allowed values are 'bw', 'color', 'bluemarble', 'shaderelief', 'etopo'
194195 rolling_proj: bool.
@@ -285,9 +286,10 @@ def add_point_data(bmp, x = [], y = [], lats = [], lons = [], style = 'ro',
285286 assert_ (np .all (x <= bmp .xmax ))
286287 assert_ (np .all (bmp .ymin <= y ))
287288 assert_ (np .all (y <= bmp .ymax ))
288- bmp .plot (x , y , style , ** kw )
289- # Use scatter if need more control over the sizes of the various points.
290- #bmp.scatter(x,y, c='r', marker='o', s = 100)
289+ #bmp.plot(x, y, style, **kw)
290+ # Use scatter if need more control over the sizes or color of the each
291+ # point.
292+ bmp .scatter (x ,y , c = 'r' , marker = 'o' , s = [200 , 400 , 600 ])
291293
292294 if text_list :
293295 for i ,text_el in enumerate (text_list ):
@@ -321,8 +323,8 @@ def add_polygon_data(bmp, x = [], y = [], lats = [], lons = [], color = 'r',
321323 bmp .plot (x , y , color + "-" , linewidth = linewidth , ** kw )
322324
323325if __name__ == "__main__" :
324- b = explore_basemap_proj (projection_type = "pseudocyl " , region = "usa" ,
325- resolution = "c" , style = 'color ' ,
326+ b = explore_basemap_proj (projection_type = "conical " , region = "usa" ,
327+ resolution = "c" , style = 'etopo ' ,
326328 rolling_proj = False )
327329
328330 lons = []
@@ -341,6 +343,6 @@ def add_polygon_data(bmp, x = [], y = [], lats = [], lons = [], color = 'r',
341343 add_point_data (b , lats = lats , lons = lons , style = 'ro' ,
342344 text_list = labels )
343345 # Draw the polygon between the cities.
344- # add_polygon_data(b, lats = lats, lons = lons, color = 'b', linewidth=2)
346+ add_polygon_data (b , lats = lats , lons = lons , color = 'b' , linewidth = 2 )
345347 show ()
346348
0 commit comments