@@ -30,9 +30,7 @@ def _getBoundsZoomLevel(lon_min, lon_max, lat_min, lat_max, mapDim):
3030 Source: https://stackoverflow.com/questions/6048975/google-maps-v3-how-to-calculate-the-zoom-level-for-a-given-bounds
3131 """
3232
33- scale = (
34- 2 # adjustment to reflect MapBox base tiles are 512x512 vs. Google's 256x256
35- )
33+ scale = 2 # adjustment to reflect MapBox base tiles are 512x512 vs. Google's 256x256
3634 WORLD_DIM = {"height" : 256 * scale , "width" : 256 * scale }
3735 ZOOM_MAX = 18
3836
@@ -295,7 +293,11 @@ def _compute_wgs84_hexbin(
295293 {"x1" : centers [:, 0 ], "x2" : centers [:, 1 ]},
296294 native_namespace = native_namespace ,
297295 )
298- .select (hexagons_ids = nw .concat_str ([nw .col ("x1" ), nw .col ("x2" )], separator = "," ))
296+ .select (
297+ hexagons_ids = nw .concat_str (
298+ [nw .col ("x1" ), nw .col ("x2" )], separator = ","
299+ )
300+ )
299301 .get_column ("hexagons_ids" )
300302 )
301303
@@ -423,7 +425,9 @@ def create_hexbin_map(
423425 lon = df .get_column (args ["lon" ]).to_numpy (),
424426 lat_range = lat_range ,
425427 lon_range = lon_range ,
426- color = df .get_column (args ["color" ]).to_numpy () if args ["color" ] else None ,
428+ color = df .get_column (args ["color" ]).to_numpy ()
429+ if args ["color" ]
430+ else None ,
427431 nx = nx_hexagon ,
428432 agg_func = agg_func ,
429433 min_count = min_count ,
@@ -440,20 +444,25 @@ def create_hexbin_map(
440444 )
441445 )
442446
443- agg_data_frame = nw .concat (agg_data_frame_list , how = "vertical" ). with_columns (
444- color = nw . col ( "color" ). cast ( nw . Int64 )
445- )
447+ agg_data_frame = nw .concat (
448+ agg_data_frame_list , how = "vertical"
449+ ). with_columns ( color = nw . col ( "color" ). cast ( nw . Int64 ))
446450
447451 if range_color is None :
448- range_color = [agg_data_frame ["color" ].min (), agg_data_frame ["color" ].max ()]
452+ range_color = [
453+ agg_data_frame ["color" ].min (),
454+ agg_data_frame ["color" ].max (),
455+ ]
449456
450457 fig = choropleth_map (
451458 data_frame = agg_data_frame .to_native (),
452459 geojson = geojson ,
453460 locations = "locations" ,
454461 color = "color" ,
455462 hover_data = {"color" : True , "locations" : False , "frame" : False },
456- animation_frame = ("frame" if args ["animation_frame" ] is not None else None ),
463+ animation_frame = (
464+ "frame" if args ["animation_frame" ] is not None else None
465+ ),
457466 color_discrete_sequence = color_discrete_sequence ,
458467 color_discrete_map = color_discrete_map ,
459468 labels = labels ,
@@ -474,7 +483,9 @@ def create_hexbin_map(
474483 original_fig = scatter_map (
475484 data_frame = (
476485 args ["data_frame" ].sort (
477- by = args ["animation_frame" ], descending = False , nulls_last = True
486+ by = args ["animation_frame" ],
487+ descending = False ,
488+ nulls_last = True ,
478489 )
479490 if args ["animation_frame" ] is not None
480491 else args ["data_frame" ]
@@ -526,6 +537,7 @@ def create_hexbin_map(
526537 ),
527538)
528539
540+
529541def create_hexbin_mapbox (* args , ** kwargs ):
530542 warnings .warn (
531543 "create_hexbin_mapbox() is deprecated and will be removed in the next major version. "
@@ -537,4 +549,4 @@ def create_hexbin_mapbox(*args, **kwargs):
537549 if "mapbox_style" in kwargs :
538550 kwargs ["map_style" ] = kwargs .pop ("mapbox_style" )
539551
540- return create_hexbin_map (* args , ** kwargs )
552+ return create_hexbin_map (* args , ** kwargs )
0 commit comments