plotly / plotly/plotly.js

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

Đang mở
#7,419 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

feature P3
Ngôn ngữ chính
JavaScript
Star
18.3k
Fork
2k
Merge trung bình
2 ngày 12 giờ
Pull request đã merge (30 ngày)
28

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với hỗ trợ textfont của Scattermap và so sánh với tài liệu về text-and-annotations cùng issue plotly.js được liên kết. Tái hiện ví dụ với các nhãn màu trắng, sau đó xác định hành vi shadow được mong đợi và xác minh rằng thuộc tính shadow được chấp nhận và làm cho các nhãn hiển thị.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript
Lĩnh vực
data-visualization
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.