plotly / plotly/plotly.R

Ggplotly does not always make a legend correctly for where there are points and lines

Đang mở
#1,816 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ả

Ggplotly does not always make a legend correctly for where there are points and lines. Sometimes it only makes the legend key based on either geom_point or geom_line, whichever is the first layer. Below is an example where it doesn't work. It seems to fix it if the data is arranged by the x variable. It'd be good if it worked for however the data was arranged.

library(dplyr)
library(ggplot2)
library(plotly)

#This doesn't work: the legend is based only on the first geom shape
plot_data <- iris %>% 
  as_tibble() %>%  
  janitor::clean_names() 

plot <- ggplot(data = plot_data, aes(petal_width, petal_length, col = species)) +
  geom_point() +
  geom_line()

plotly::ggplotly(plot)

image

plot_data <- iris %>% 
  as_tibble() %>%  
  janitor::clean_names() %>% 
  arrange(petal_width)

plot <- ggplot(data = plot_data, aes(petal_width, petal_length, col = species)) +
  geom_point() +
  geom_line()

plotly::ggplotly(plot)

image

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. 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 tái hiện ví dụ R được cung cấp với plotly::ggplotly, so sánh dữ liệu iris chưa được sắp xếp với phiên bản được sắp xếp theo petal_width. Issue được hoàn tất khi chú giải biểu diễn chính xác cả lớp điểm và lớp đường, bất kể thứ tự các hàng dữ liệu.

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

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.