Cannot have more than one shape after subplot()
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ả
I guess this is related to #1333
Here is the issue: it doesn't seem possible to have more than one shape after subplot() is called. Applying the shapes to the individual plots work, though.
reprex that works:
library(plotly)
p1 <- plot_ly(mtcars, x = ~mpg, y = ~hp) %>%
layout(
shapes = list(
list(
type = "line",
line = list(color = "#5681c4", dash = "dot"),
x0 = 20,
x1 = 20,
y0 = 0,
y1 = 1,
yref = "paper"
),
list(
type = "line",
line = list(color = "#5681c4", dash = "solid"),
x0 = 30,
x1 = 30,
y0 = 0,
y1 = 1,
yref = "paper"
)
)
) %>%
config(editable = TRUE)
p2 <- plot_ly(mtcars, x = ~mpg, y = ~drat) %>%
layout(
shapes = list(
list(
type = "line",
line = list(color = "#5681c4", dash = "dot"),
x0 = 20,
x1 = 20,
y0 = 0,
y1 = 1,
yref = "paper"
),
list(
type = "line",
line = list(color = "#5681c4", dash = "solid"),
x0 = 30,
x1 = 30,
y0 = 0,
y1 = 1,
yref = "paper"
)
)
) %>%
config(editable = TRUE)
subplot(p1, p2, nrows = 2)
reprex that does not work:
library(plotly)
p1 <- plot_ly(mtcars, x = ~mpg, y = ~hp)
p2 <- plot_ly(mtcars, x = ~mpg, y = ~drat)
subplot(p1, p2, nrows = 2) %>%
layout(
shapes = list(
list(
type = "line",
line = list(color = "#5681c4", dash = "dot"),
x0 = 20,
x1 = 20,
y0 = 0,
y1 = 1,
yref = "paper"
),
list(
type = "line",
line = list(color = "#5681c4", dash = "solid"),
x0 = 30,
x1 = 30,
y0 = 0,
y1 = 1,
yref = "paper"
)
)
) %>%
config(editable = TRUE)
reprex with only one shape - it works:
library(plotly)
p1 <- plot_ly(mtcars, x = ~mpg, y = ~hp)
p2 <- plot_ly(mtcars, x = ~mpg, y = ~drat)
subplot(p1, p2, nrows = 2) %>%
layout(
shapes = list(
type = "line",
line = list(color = "#5681c4", dash = "dot"),
x0 = 20,
x1 = 20,
y0 = 0,
y1 = 1,
yref = "paper"
)
) %>%
config(editable = TRUE)
Any thoughts?
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 bằng cách chạy các reprex hoạt động và bị lỗi trong issue, so sánh các shapes được cung cấp cho từng plot với các shapes được thêm sau subplot(). Theo dõi cách subplot() kết hợp các plot và cách lời gọi layout(shapes = ...) sau đó được xử lý. Hoàn tất khi cả hai shapes đều được render trong subplot và vẫn có thể chỉnh sửa bằng config(editable = TRUE).
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- r
- 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