Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Spriteware opened this issue May 7, 2025 · 0 comments
Labels
feature something new P3 backlog

Comments

@Spriteware
Copy link

Spriteware commented May 7, 2025

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

@gvwilson gvwilson added feature something new P3 backlog labels May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P3 backlog
Projects
None yet
Development

No branches or pull requests

2 participants