Categoryorder not working when specifying plot type
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ả
When using the category order parameter, no plot is generated if the plot type is specified in the plot_ly call:
p <- plotly::plot_ly(type = 'bar')
colNames <- names(iris)
colNames <- colNames[-which(colNames == 'Species')]
for(trace in colNames){
p <- p %>% plotly::add_trace(data= iris, x = ~ Species, y = as.formula(paste0("~`", trace, "`")), name = trace)
}
p %>% layout(xaxis = list(categoryorder='total descending'))
With the following warning, which I don't understand since I'm not combining discrete and non-discrete data in the same axis:
Warning message:
Can't display both discrete & non-discrete data on same axis
If I specify the type in add_trace instead of the plot, then it works correctly and the warning is gone:
p <- plotly::plot_ly()
colNames <- names(df)
colNames <- colNames[-which(colNames == 'Species')]
for(trace in colNames){
p <- p %>% plotly::add_trace(type = 'bar', data= iris, x = ~ Species, y = as.formula(paste0("~`", trace, "`")), name = trace)
}
p %>% layout(xaxis = list(categoryorder='total descending'))
Maybe this is the intended behavior? If so, why does specifying the type in the traces works and not in the plot? The warning seems unclear to me.
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 reproduction R được cung cấp với iris và so sánh plot_ly(type = 'bar') với add_trace(type = 'bar'). Truy vết cách plot_ly và add_trace truyền type như thế nào và cách layout(xaxis = list(categoryorder = 'total descending')) xử lý các trace kết quả. Hoàn tất nghĩa là reproduction không còn phát ra cảnh báo và việc sắp xếp category hoạt động nhất quán.
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ó
- 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
- 48/100