Adding Mapbox Shapes

I’d like to use Plotly to draw a mapbox overlay that consists of

-line segments/paths/polygons that won’t change
-markers that will be added and removed frequently

I did something similar but without mapbox by creating shapes for the static elements using the data field for the markers. In this way I could set the data of the plotly chart element to the new markers and use the redraw() command. This allowed me to make sure that Plotly didn’t redraw the background static elements every time the data changed.

I’d like to use this same workflow for the mapbox overlay version, but shapes doesn’t let you create any mapbox elements. Is there anyway to implement shape elements in a mapbox?

I know I could just contain the entire visualization in the data field but this would make updating it slow.

The mapbox equivalent for shapes are mapbox.layers, see for an example (open up the console to see its corresponding data / layout attributes).

1 Like

worked great, the one thing I can’t do is make lines dashed. It seems like the place to set that option would be under the line attribute below, but it doesn’t look like plotly supports that.

			{"source": {
				"type": "FeatureCollection",
				"features": [features]
			"type": "line",
			"color": "yellow",
			"opacity": 1,
			'line': {'width': 1 , 'dash' : 'dash' (WISH THIS WORKED)}}

We don’t support dashed lines at the moment on mapbox subplots at the moment.