Santiago Estrada
Santiago Estrada

Reputation: 1

Marker disappears when changing its symbol in plotly express

I am currently doing a scatter map of Colombia with some points that need to be differentiated according to a categorical variable. The color changes fine but it suddenly stops showing on the map when I try to change its symbol. Oddly enough, it still comes up in the legend.

This is my code:

import plotly.express as px

fig = px.scatter_mapbox(datos, lat="latitud", lon="longitud", hover_name="id_direccion",
                        zoom=1, center=dict(lat=7, lon=-74.2973328), 
                        mapbox_style="open-street-map",
                        hover_data=["Origen"],
                        color = "Origen"
                        )


fig.update_layout(title="Coordinadora")
fig.update_layout(mapbox_bounds={"west": -83, "east": -65, "south": -5, "north": 16})
fig.update_layout(width=800, height=700)

fig.show()

Output map without changing marker symbols

I tried to use this line of code but that's when the issue arises: fig.update_traces(marker={"symbol": "circle-open", }, selector={"name": "here"})

Output map changing marker symbols

It is worth noting that I have a DataFrame called datos with four columns: latitud, longitud, id_direccion, and Origen. Origen is categorical and it can take values such as here or GPS, etc.

Upvotes: 0

Views: 62

Answers (0)

Related Questions