Scattermapbox with multiple datasets


#1

Using scattermapbox with multiple datasets and one of the datasets uses a colorbar, it seems that all the color attribute of the other datasets are overridden. Maybe the colorbar is being applied to all datasets?

Here’s a minimal example (MAPBOX_KEY environment variable ommitted), where the “star” marker appears black rather than red.

import os
import dash
import dash_core_components as dcc
import dash_html_components as html

app = dash.Dash()

MAPBOX_KEY = os.environ['MAPBOX_KEY']

app.layout = html.Div([
    dcc.Graph(
        id='example-graph',
        figure = dict(
            data = [
                dict(
                    lon = [-68, -120, -80],
                    lat = [49, 50, 43],
                    type = 'scattermapbox',
                    marker = dict(
                        color = [1, 2, 3],
                        showscale = True
                    )
                ),
                dict(
                    name = 'Optimal centers',
                    type = 'scattermapbox',
                    lon = [-68],
                    lat = [45],
                    marker = dict(
                        color = 'red',
                        symbol = 'star'
                    )
                )
            ],
            layout = dict(mapbox = dict(accesstoken=MAPBOX_KEY))
        )
    )
])

if __name__ == '__main__':
    app.run_server(debug=True)

#2

Hey @amarv

This actually looks more like a plotly.js issue regarding marker symbols in mapbox. That is, in this example it if you remove symbol than it ought to work as expected.

I’ve opened a plotly.js issue, which can you monitor here


#3

Thanks @bcd. Removing the symbol attribute and thus using the default market symbol works, and it a decent solution for now.