@@ -426,7 +426,11 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
426426 # as a list of row lists, which is what we want
427427 trace_patch ["customdata" ] = trace_data [customdata_cols ]
428428 elif attr_name == "color" :
429- if trace_spec .constructor in [go .Choropleth , go .Choroplethmapbox ]:
429+ if trace_spec .constructor in [
430+ go .Choropleth ,
431+ go .Choroplethmap ,
432+ go .Choroplethmapbox ,
433+ ]:
430434 trace_patch ["z" ] = trace_data [attr_value ]
431435 trace_patch ["coloraxis" ] = "coloraxis1"
432436 mapping_labels [attr_label ] = "%{z}"
@@ -532,6 +536,9 @@ def configure_axes(args, constructor, fig, orders):
532536 go .Scatterpolar : configure_polar_axes ,
533537 go .Scatterpolargl : configure_polar_axes ,
534538 go .Barpolar : configure_polar_axes ,
539+ go .Scattermap : configure_map ,
540+ go .Choroplethmap : configure_map ,
541+ go .Densitymap : configure_map ,
535542 go .Scattermapbox : configure_mapbox ,
536543 go .Choroplethmapbox : configure_mapbox ,
537544 go .Densitymapbox : configure_mapbox ,
@@ -739,6 +746,20 @@ def configure_mapbox(args, fig, orders):
739746 )
740747
741748
749+ def configure_map (args , fig , orders ):
750+ center = args ["center" ]
751+ if not center and "lat" in args and "lon" in args :
752+ center = dict (
753+ lat = args ["data_frame" ][args ["lat" ]].mean (),
754+ lon = args ["data_frame" ][args ["lon" ]].mean (),
755+ )
756+ fig .update_maps (
757+ center = center ,
758+ zoom = args ["zoom" ],
759+ style = args ["map_style" ],
760+ )
761+ 762+ 742763def configure_geo (args , fig , orders ):
743764 fig .update_geos (
744765 center = args ["center" ],
@@ -1911,15 +1932,21 @@ def infer_config(args, constructor, trace_patch, layout_patch):
19111932 else :
19121933 trace_patch ["texttemplate" ] = "%{" + letter + ":" + args ["text_auto" ] + "}"
19131934
1914- if constructor in [go .Histogram2d , go .Densitymapbox ]:
1935+ if constructor in [go .Histogram2d , go .Densitymap , go . Densitymapbox ]:
19151936 show_colorbar = True
19161937 trace_patch ["coloraxis" ] = "coloraxis1"
19171938
19181939 if "opacity" in args :
19191940 if args ["opacity" ] is None :
19201941 if "barmode" in args and args ["barmode" ] == "overlay" :
19211942 trace_patch ["marker" ] = dict (opacity = 0.5 )
1922- elif constructor in [go .Densitymapbox , go .Pie , go .Funnel , go .Funnelarea ]:
1943+ elif constructor in [
1944+ go .Densitymap ,
1945+ go .Densitymapbox ,
1946+ go .Pie ,
1947+ go .Funnel ,
1948+ go .Funnelarea ,
1949+ ]:
19231950 trace_patch ["opacity" ] = args ["opacity" ]
19241951 else :
19251952 trace_patch ["marker" ] = dict (opacity = args ["opacity" ])
@@ -1937,7 +1964,7 @@ def infer_config(args, constructor, trace_patch, layout_patch):
19371964 modes .add ("lines" )
19381965 trace_patch ["mode" ] = "+" .join (sorted (modes ))
19391966 elif constructor != go .Splom and (
1940- "symbol" in args or constructor == go .Scattermapbox
1967+ "symbol" in args or constructor in [ go .Scattermap , go . Scattermapbox ]
19411968 ):
19421969 trace_patch ["mode" ] = "markers" + ("+text" if args ["text" ] else "" )
19431970
@@ -2154,7 +2181,9 @@ def make_figure(args, constructor, trace_patch=None, layout_patch=None):
21542181 go .Parcats ,
21552182 go .Parcoords ,
21562183 go .Choropleth ,
2184+ go .Choroplethmap ,
21572185 go .Choroplethmapbox ,
2186+ go .Densitymap ,
21582187 go .Densitymapbox ,
21592188 go .Histogram2d ,
21602189 go .Sunburst ,
@@ -2198,7 +2227,8 @@ def make_figure(args, constructor, trace_patch=None, layout_patch=None):
21982227 ):
21992228 trace .update (marker = dict (color = m .val_map [val ]))
22002229 elif (
2201- trace_spec .constructor in [go .Choropleth , go .Choroplethmapbox ]
2230+ trace_spec .constructor
2231+ in [go .Choropleth , go .Choroplethmap , go .Choroplethmapbox ]
22022232 and m .variable == "color"
22032233 ):
22042234 trace .update (
@@ -2281,7 +2311,11 @@ def make_figure(args, constructor, trace_patch=None, layout_patch=None):
22812311 )
22822312
22832313 if show_colorbar :
2284- colorvar = "z" if constructor in [go .Histogram2d , go .Densitymapbox ] else "color"
2314+ colorvar = (
2315+ "z"
2316+ if constructor in [go .Histogram2d , go .Densitymap , go .Densitymapbox ]
2317+ else "color"
2318+ )
22852319 range_color = args ["range_color" ] or [None , None ]
22862320
22872321 colorscale_validator = ColorscaleValidator ("colorscale" , "make_figure" )
0 commit comments