dynamicTicks = TRUE is incompatible with grouped geom_line
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- r
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Điểm bắt đầu có thể tái lập là lệnh gọi ggplotly(p1, dynamicTicks = TRUE) trong ví dụ được cung cấp, với geom_line được nhóm theo interaction(patient, gene); hãy bắt đầu bằng cách cô lập tổ hợp này. Được xem là hoàn tất khi lệnh gọi chạy xong mà không gặp lỗi lập chỉ mục ticktext đã báo cáo, đồng thời vẫn giữ được cả hai đường đã nhóm và các tick động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi,
I am trying to make an interactive plot using crosstalk where the user selects a variable from a drop down menu and the plot updates to show only data for it.
library(ggplot2)
library(dplyr)
library(plotly)
library(crosstalk)
#### DATA
df <- rbind.data.frame(
cbind.data.frame(
gene = "geneA",
patient = rep(c("patient_A", "patient_B"), each=2),
time = rep(c("t1","t2"),times=2),
value = c(1.25, 1.5, 2, 1.75)
),
cbind.data.frame(
gene = "geneB",
patient = rep(c("patient_A", "patient_B"), each=2),
time = rep(c("t1","t2"),times=2),
value = c(1.25, 0.25, 3, 3.5)
)
)
df$time <- factor(df$time)
df$gene <- factor(df$gene)
df$patient <- factor(df$patient)
df$gene_x_patient <- factor(paste0(df$gene,"_",df$patient))
#### HIGHLIGHT
df1 <- highlight_key(df, ~gene, group="Gene name")
#### FILTER SELECT
filter_gene_1 <- filter_select("id_filter_counts", "Selected gene", df1, ~gene, multiple = FALSE)
#### FIGURE
p1 <- ggplot(df1, aes(x=time, y=value)) +
geom_line(aes(group=interaction(patient,gene))) +
geom_point(aes(shape=patient, fill=gene), size=5) +
scale_shape_manual(values=c(21,25)) +
guides(
fill = guide_legend(
override.aes = list(alpha=1, shape=21, size=5)) )
p1_highlight <- ggplotly(p1,
# dynamicTicks = TRUE,
width=600,
height=450,
tooltip = "text"
) %>%
hide_guides() %>%
config(displayModeBar = F) %>%
layout(
xaxis = list(fixedrange = TRUE),
yaxis = list(fixedrange = TRUE)
) %>%
highlight(on = NULL, off=NULL)
#### PRINT
bscols(
filter_gene_1,
p1_highlight,
widths = c(8,6)
)
This generates a figure like this:
https://github.com/user-attachments/assets/149370ac-fe85-413d-bf6b-67d62b7f6272
If I remove the geom_line call, and uncomment dynamicTicks = TRUE, I get this:
https://github.com/user-attachments/assets/e6898855-8634-4d3b-a6ac-1a66cd4fcc76
However, if I use both geom_line and dynamicTicks = TRUE, then, the ggplotly call returns this error:
Error in ticktext[[which.min(abs(tickvals - val))]] :
attempt to select less than one element in get1index
I haven't seen this reported anywhere. I'd really like to use both options at once.
sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: x86_64-apple-darwin20
Running under: macOS Monterey 12.7.6Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8time zone: Europe/Madrid
tzcode source: internalattached base packages:
[1] stats graphics grDevices utils datasets methods baseother attached packages:
[1] crosstalk_1.2.1 plotly_4.11.0 dplyr_1.1.4 ggplot2_3.5.2loaded via a namespace (and not attached):
[1] gtable_0.3.6 jsonlite_2.0.0 compiler_4.4.0
[4] promises_1.3.3 tidyselect_1.2.1 Rcpp_1.1.0
[7] dichromat_2.0-0.1 later_1.4.2 tidyr_1.3.1
[10] scales_1.4.0 yaml_2.3.10 fastmap_1.2.0
[13] mime_0.13 R6_2.6.1 labeling_0.4.3
[16] generics_0.1.4 knitr_1.50 htmlwidgets_1.6.4
[19] tibble_3.3.0 shiny_1.11.1 pillar_1.11.0
[22] RColorBrewer_1.1-3 rlang_1.1.6 httpuv_1.6.16
[25] xfun_0.52 lazyeval_0.2.2 viridisLite_0.4.2
[28] cli_3.6.5 withr_3.0.2 magrittr_2.0.3
[31] digest_0.6.37 grid_4.4.0 xtable_1.8-4
[34] rstudioapi_0.17.1 lifecycle_1.0.4 vctrs_0.6.5
[37] evaluate_1.0.4 glue_1.8.0 data.table_1.17.8
[40] farver_2.1.2 purrr_1.1.0 httr_1.4.7
[43] tools_4.4.0 pkgconfig_2.0.3 htmltools_0.5.8.1
- 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 ·