scattermapbox non-circle marker symbols not shown in legend since v4.12.0
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- R
- Star
- 2.7k
- Fork
- 641
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Since upgrading to plotly 4.12.0, only the "circle" symbol is rendered correctly in the legend for scattermapbox traces. Other marker symbols (e.g. "diamond", "square") are no longer displayed — the legend shows a blank entry for those.
v 4.12.0
v 4.11.0
(note that already in previuos versions, the non-circle markers were not shown on the canvas itself, but this was not an issue in our use case, because we only wanted to create the custom legend with the square markers)
reprex
library(plotly)
symbols_to_try <- c(
"circle",
"diamond",
"square",
"marker"
)
traces <- lapply(seq_along(symbols_to_try), function(i) {
list(
type = "scattermapbox",
mode = "markers",
lon = i * 2,
lat = 51,
name = symbols_to_try[i],
showlegend = TRUE,
hoverinfo = "name",
marker = list(
color = "steelblue",
size = 20,
symbol = symbols_to_try[i]
)
)
})
p <- plotly_empty() |>
layout(
mapbox = list(
style = "carto-positron",
center = list(lon = 5, lat = 51),
zoom = 3
),
legend = list(x = 1, xanchor = "right", y = 1)
) |>
config(displaylogo = FALSE)
for (tr in traces) {
p <- add_trace(p,
inherit = FALSE,
type = tr$type,
mode = tr$mode,
lon = tr$lon,
lat = tr$lat,
name = tr$name,
showlegend = tr$showlegend,
hoverinfo = tr$hoverinfo,
marker = tr$marker
)
}
p
packageVersion("plotly")
Further info:
The legend (and markers on canvas) work fine with "scattergeo" or even "scatter", but it has other side-effects in our setting that makes the plot be drawn twice, even if setting the layout like
plotly::layout(
plotly_object,
geo = list(
visible = FALSE,
showframe = FALSE,
showcoastlines = FALSE,
showland = FALSE,
showocean = FALSE
)
)
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với reprex R được cung cấp bằng cách sử dụng các trace scattermapbox và so sánh hành vi của chú giải giữa plotly 4.11.0 và 4.12.0. Theo dõi cách các ký hiệu marker được truyền qua add_trace và kiểm tra việc xử lý chú giải của scattermapbox; hoàn tất khi các mục circle, diamond, square và marker được hiển thị chính xác mà không ảnh hưởng đến hành vi của scattergeo hoặc scatter.
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, r
- Lĩnh vực
- data-visualization
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 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
- 38/100