plotly failures with dev rlang
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- r
- Lĩnh vực
- data-visualization, testing
Hướng nghiên cứu
Lỗi này được bao phủ bởi tests/testthat/test-ggplot-legend.R, và tiêu đề của các guide được ghép trong ggplotly.R quanh các dòng 1071-1072. Bắt đầu bằng cách chạy test đang thất bại với phiên bản dev của rlang và kiểm tra cách thứ tự của các guide được xác định. Hoàn thành khi test tiêu đề chú giải chạy thành công với thứ tự xác định trong phiên bản rlang đã được cập nhật.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I'm seeing failures for plotly with dev rlang:
Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library("testthat")
> library("plotly")
Loading required package: ggplot2
Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
...
Expected `legend_title` to match regexp "factor\\(cyl\\)$".
Actual text:
✖ │ factor(cyl)<br />factor(vs)
[ FAIL 2 | WARN 23 | SKIP 63 | PASS 1449 ]
Deleting unused snapshots: 'ggplot-contour/contour.svg' and
'ggplot-heatmap/heatmap.svg'
Error:
! Test failures.
Execution halted
Claude traced this to rlang::hash() producing different hashes in the new version (which was deliberate to fix other stability issues see https://github.com/r-lib/rlang/issues/1681#issuecomment-4267291605):
The chain is:
1. rlang dev changed hash() values (commit 229db8154 — "Stable hash()"). The NEWS says: "with this version all hash values will now be different". This is intentional for cross-R-version
stability.
2. ggplot2's Guides$merge sorts by hash. In Guides$merge(), each guide gets a key {order}_{hash} and then split(pairs, hashes) is called. R's split() returns groups in alphabetical order
of factor levels. So the final guide order depends on the alphabetical sort of the hash strings.
3. plotly concatenates guide titles in order. At ggplotly.R:1071-1072:
legendTitles <- compact(lapply(gdefs, function(g) if (inherits(g, "legend")) g$title else NULL))
legendTitle <- paste(legendTitles, collapse = br())
4. The plotly test asserts a specific order (test-ggplot-legend.R:32-33):
expect_match(legend_title, "^factor\\(vs\\)") # vs first
expect_match(legend_title, "factor\\(cyl\\)$") # cyl last
With CRAN rlang, the hashes sort as 99_124c... (vs) < 99_4d3... (cyl) → title = factor(vs)<br />factor(cyl).
With dev rlang, the hashes sort as 99_aefe... (cyl) < 99_ebf7... (vs) → title = factor(cyl)<br />factor(vs).
I've talked to the ggplot2 maintainers and they recommend using the order argument to make guide placement deterministic. Claude also suggests this fix (unverified):
diff --git a/tests/testthat/test-ggplot-legend.R b/tests/testthat/test-ggplot-legend.R
index 9dd92ea..d1d97e5 100644
--- a/tests/testthat/test-ggplot-legend.R
+++ b/tests/testthat/test-ggplot-legend.R
@@ -29,8 +29,8 @@ test_that("Discrete colour and shape get merged into one legend", {
nms, paste0("(", d$vs, ",", d$cyl, ")")
)
legend_title <- info$layout$legend$title$text
- expect_match(legend_title, "^factor\\(vs\\)")
- expect_match(legend_title, "factor\\(cyl\\)$")
+ expect_match(legend_title, "factor\\(vs\\)")
+ expect_match(legend_title, "factor\\(cyl\\)")
})
As a heads up, I'm planning to release this rlang update within the next two weeks.
- 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
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.
Issue khác của plotly/plotly.R
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
-
Data gets dropped in add_trace and consequently points have the wrong color if NA is present Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
-
save_image Error Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
Tất cả issue của plotly/plotly.R
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
r-lib/pkgdepends#485 · 3 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
beginners blocker
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
enviPathR Đang mởBuild Error Build OK Build Warning policies-accepted pre-review precheck-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Bioconductor/BiocContributions#207 · 6 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
datacarpentry/semester-biology#1255 ·