Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23390

Set symbol to discrete map with plotly scattermapbox - python

$
0
0

Is it possible to set a discrete symbol map for plotly scattermapbox. color and color_discrete_map can be used to assign a certain color but can the same approach be used to assign a specific symbol using a discrete map?

With below, I want to assign the symbol_dict to the unique values in species.

import plotly.express as pximport pandas as pddf = px.data.iris()symbol_dict = {'versicolor': 'star', 'setosa': 'circle', 'virginica': 'diamond'}fig = px.scatter_mapbox(    df,    lat="sepal_width",    lon="sepal_length",    #symbol="species", # set symbol to species    #symbol_map=symbol_dict, # set symbol to species)fig.update_layout(mapbox_style = "carto-positron")fig.update_mapboxes(zoom = 5)fig.show()

Viewing all articles
Browse latest Browse all 23390

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>