You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried legend=False but it does not work. I wanted to assign the radius and the color of the circles based on two properties, but it leads to a problem that there creates two legends which either overlap each other or overlap the map. How can I fix that?
The text was updated successfully, but these errors were encountered:
Hi @xchen0326 sorry for the delay. Hope you found a workaround in the meantime! This bug is due to an oversight where some default values are not being set in the main.html template when legend is set to False. The easiest way around this would be to update the mapboxgl.viz.MapViz.create_html method so that all of the legend-based settings are included in the template either way. This could be as simple as changing lines 303-322 https://github.com/mapbox/mapboxgl-jupyter/blob/master/mapboxgl/viz.py#L303-L322 to the following:
ifself.legend:
ifall([self.legend, self.legend_gradient, self.legend_function=='radius']):
raiseLegendError(' '.join(['Gradient legend format not compatible with a variable radius legend.',
'Please either change `legend_gradient` to False or `legend_function` to "color".']))
options.update(
showLegend=self.legend,
legendLayout=self.legend_layout,
legendFunction=self.legend_function,
legendStyle=self.legend_style, # reserve for custom CSSlegendGradient=json.dumps(self.legend_gradient),
legendFill=self.legend_fill,
legendHeaderFill=self.legend_header_fill,
legendTextColor=self.legend_text_color,
legendNumericPrecision=json.dumps(self.legend_text_numeric_precision),
legendTitleHaloColor=self.legend_title_halo_color,
legendKeyShape=self.legend_key_shape,
legendKeyBordersOn=json.dumps(self.legend_key_borders_on)
)
(basically move the options.update({...}) outside of the if self.legend if block. Does that make sense? I think the CSS needs an overhaul so I'll think if there's a good way to address this there.
I tried legend=False but it does not work. I wanted to assign the radius and the color of the circles based on two properties, but it leads to a problem that there creates two legends which either overlap each other or overlap the map. How can I fix that?
The text was updated successfully, but these errors were encountered: