subplot() not producing the interactive equivalent of gridExtra::grid.arrange()
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ả
Given:
library(ggplot2)
library(gridExtra)
library(plotly)
library(colorRamps)
d <- data.frame(x=sample(1:10)/10, y=sample(1:10)/10, z=sample(1:10)/10, c=sample(LETTERS[1:5],size=10,replace=TRUE))
g1 <- ggplot(d) +
geom_point(aes(x=x, y=y, fill = z),
pch=21,size=4) +
facet_wrap(~c,labeller = label_both) +
scale_fill_gradientn(colors = matlab.like2(16),limits=c(0, 100)) +
xlim(c(0,1)) + ylim(c(0,1)) +
coord_fixed(ratio = 1) +
theme(legend.position=c(0.85,0.2), legend.background=element_blank()) +
labs(fill = "%")
g2<- g1+ggtitle("Plot 2")
g3<- g1+gtitle("Plot 3")
g4<- g1+ggtitle("Plot 4")
g1<- g1+ggtitle("Plot 1")
p = list(g1,g2,g3,g4) %>% map(~.x + labs(x=NULL, y=NULL))
yleft= "X"
xbottom= "Y"
grid.arrange(grobs=p,bottom = xbottom, left = yleft,nrow=2)
I want to get the same plot but with interactive browsing of the values. I try:
pg1 <- ggplotly(g1)
pg2 <- ggplotly(g2)
pg3 <- ggplotly(g3)
pg4 <- ggplotly(g4)
Individual plots are ok:
pg1
But
subplot(list(pg1, pg2,pg3,pg4), nrows=2,
shareX=FALSE, shareY=FALSE,titleX=TRUE,titleY=TRUE)
or
subplot(list(pg1, pg2,pg3,pg4), nrows=2,
shareX=FALSE, shareY=FALSE,titleX=FALSE,titleY=FALSE)
result into:
Which is almost good but displays only 1 title (and in the wrong place) and no axes titles.
I try
subplot(list(pg1, pg2,pg3,pg4), nrows=2,
shareX=TRUE, shareY=TRUE,titleX=FALSE,titleY=FALSE)
and
subplot(list(pg1, pg2,pg3,pg4), nrows=2,
shareX=TRUE, shareY=TRUE,titleX=TRUE,titleY=TRUE)
and the result is even worse:
Is this a bug or am I doing something wrong? Is there an alternative way to get the interactive version of the grid?
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 các lệnh gọi ggplotly() và subplot() được tái hiện trong issue, so sánh đầu ra của chúng với grid.arrange(). Theo dõi cách subplot() xử lý nhiều tiêu đề biểu đồ, các trục dùng chung và tiêu đề trục. Được xem là hoàn tất khi bốn biểu đồ đã chuyển đổi vẫn giữ các tiêu đề và trục như mong đợi trong bố cục tương tác gồm hai hàng, hoặc khi hành vi này được ghi lại là một hạn chế.
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