plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

Invalid property specified for object of type plotly.graph_objs.scattermap.Textfont: 'shadow'

Open Spriteware opened this issue 8 months ago • 0 comments

Hello,

First, thank you for your work.

It seems like the text "shadow" parameter (here in the doc) is missing for go.Scattermap objects. Without this parameter, we are unable to create visible labels on maps: this is the same problem as report here.

Here is an example of the problem and why border/shadow is required: Image

Here is a minimum reproducible code

import plotly.graph_objects as go

# Sample data
data = {
    "label": ["New York", "Los Angeles", "Chicago"],
    "latitude": [40.7128, 34.0522, 41.8781],
    "longitude": [-74.0060, -118.2437, -87.6298]
}

# Create a Scattermapbox trace
go.Figure(
    go.Scattermap(
        lat=data["latitude"],
        lon=data["longitude"],
        text=data["label"],
        textfont={
            "color": "white",
            "size": 12,
            #"shadow": "1px 1px 1px black"  # THIS IS THE ISSUE 
        },
        mode="text",
    )
)
# Update layout to include a map style and center
fig.update_layout(
    map=dict(
        style="open-street-map",
        center=dict(lat=37.0902, lon=-95.7129),  # Centered over the USA
        zoom=3
    ),
    margin={"r":0,"t":0,"l":0,"b":0}
)

fig.show()

Result : Image This time the labels are white and require black shadow/border to be visible.

Plotly version: 5.24.0 python version: 5.11.11

Spriteware avatar May 07 '25 08:05 Spriteware