Skip to content

Unable to change the color of symbols like "triangle" in scattermap trace #5153

Closed

Description

@satheesh22g

Description:

When using symbols like "triangle" (or other shapes) in a scattermap trace, I am unable to change the color of the symbol. Despite setting the marker color, the symbol color remains unchanged.

Steps to Reproduce:

  1. Create a scattermap trace with a symbol, such as a triangle.
  2. Set the marker parameter with a color.
  3. Notice that the symbol (triangle) color does not change as expected.

Expected Behavior:

The color of the symbol (e.g., triangle, square) should change according to the marker.color settings.

Actual Behavior:

The symbol does not change color when the marker.color is set, even though it should.

Code Snippet:

import plotly.graph_objs as go

fig = go.Figure(go.Scattermap(
    lat=[40.748817],
    lon=[-73.985428],
    mode='markers',
    marker=dict(size=14, symbol='triangle', color='red'),
    text="Sample Point"
))

fig.update_layout(
    map_style="open-street-map",
    map_center={"lat": 40.748817, "lon": -73.985428},
    map_zoom=10
)

fig.show()
Image

Activity

  1. afafelwafi commented on Apr 25, 2025

    @afafelwafi

    I am experiencing the same issue, not only with the triangle symbol but also with the square (the circle symbol works fine). This problem does not occur when using go.Scatter; it only manifests when using Mapbox. I think the issue might be related to how Mapbox GL JS handles symbol rendering, possibly due to the way Mapbox’s internal sprite system processes the marker.symbol parameter in conjunction with Plotly's integration.

  2. srahabib commented on Apr 26, 2025

    @srahabib

    I found this note in the plotly.graph_objects.Scattermap documentation:

    Image

    It seems that currently in scattermap, only the 'circle' symbol properly supports color and size customization. Other symbols like 'triangle', 'square', etc., don't yet allow changes to their fill color through marker.color.

    Documentation link: https://plotly.com/python-api-reference/generated/plotly.graph_objects.Scattermap.html

  3. satheesh22g commented on Apr 29, 2025

    @satheesh22g
    Author

    I found this note in the plotly.graph_objects.Scattermap documentation:

    Image

    It seems that currently in scattermap, only the 'circle' symbol properly supports color and size customization. Other symbols like 'triangle', 'square', etc., don't yet allow changes to their fill color through marker.color.

    Documentation link: https://plotly.com/python-api-reference/generated/plotly.graph_objects.Scattermap.html

    you're right, since plotly uses Maki icons for symbols like triangles, their color and size can't be changed. But it would really help if they offered more triangle styles, like a white triangle with a black outline, the current solid black triangle looks messy when there are many points.

  4. svenvdvoort commented on Jan 2, 2026

    @svenvdvoort

    Hey everyone, thanks for bringing this up! To add to the discussion: currently Plotly throws a general error in JavaScript when a list of color values are passed in combination with a symbol as a marker properties:

    fig = go.Figure()
    fig.add_trace(
        trace = go.Scattermap(
            lat=[1, 0],
            lon=[0, 1],
            marker=dict(
                color=[0.5, 1.6],
                symbol="square",
            ),
        )
    )
    fig.show()
    Image

    It would really help if a descriptive error was raised, for example: Currently the marker color property can not be used together with a shape property other than circle. :)

    Thanks!

  5. emilykl commented on Sep 2, 2026

    @emilykl
    Contributor

    Hi @satheesh22g @afafelwafi, apologies for the very belated reply. This bug was fixed by plotly/plotly.js#7825 and first released in plotly.py v7.0.0. Setting Scattermap marker colors now works as expected:

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogbugsomething broken

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions