plotly / plotly/plotly.js

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

未关闭
#7,419 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

feature P3
主要语言
JavaScript
星标
18.3k
派生
2k
平均合并
2 天 12 小时
30 天内合并 PR
28

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 Scattermap 对 textfont 的支持开始,并将其与 text-and-annotations 文档和链接的 plotly.js issue 进行比较。复现带有白色标签的示例,然后确定预期的 shadow 行为,并验证 shadow 属性能够被接受且会使标签可见。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
data-visualization
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。