Summary statistics (mean, median, ...) in type_violin?

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

Maintainer thường phản hồi trong vòng 1 ngày

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
45/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Sôi nổi
Công nghệ
r
Lĩnh vực
data-visualization

Hướng nghiên cứu

Bắt đầu bằng cách đọc các entry point type_violin() và type_summary(), sau đó tái hiện các ví dụ ToothGrowth trong issue và xem xét phần thảo luận về factor x trong #436. Làm rõ liệu các summary thuộc về type_violin() hay type_summary(), bao gồm factor x, việc nhóm, phép đặt cạnh nhau và hành vi của pch. Công việc được xem là hoàn tất khi interface được chọn căn chỉnh các summary với các violin và bao phủ các trường hợp đã nêu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Is there a sufficiently easy way to add summary statistics like mean or median to violin plots? If not, then maybe this could be added to type_violin() itself?

At first, I thought that type_summary() could be used for this but this is not fully straightforward because it

  • does not yet support factor x variables, see #436
  • handles by variables without juxtaposition

Examples:

Image

In the case with numeric x the violin and the points are misaligned (see left panel) because type_violin always treats x as factor and type_summary always expects numeric:

tinyplot(len ~ dose, data = ToothGrowth, fill = 0.2,  type = "violin")
tinyplot_add(type = type_summary(median, type = "p"))

Using a factor x is currently not possible in type_summary:

tinyplot(len ~ factor(dose), data = ToothGrowth, fill = 0.2,  type = "violin")
tinyplot_add(type = type_summary(median, type = "p"))
## Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,  : 
##   'range' not meaningful for factors

Only when the numeric values are 1, ..., k then violin and summary points are aligned (center panel):

tinyplot(len ~ as.numeric(as.factor(dose)), data = ToothGrowth, fill = 0.2,  type = "violin")
tinyplot_add(type = type_summary(median, type = "p"))

However, even in that case, by groups are handled differently with vs without juxtaposition (right panel):

tinyplot(len ~ as.numeric(as.factor(dose)) | supp, data = ToothGrowth, fill = 0.2,  type = "violin", legend = FALSE)
tinyplot_add(type = type_summary(median, type = "p"))

I guess this would indicate that adding some summary option to type_violin directly would be best?

Aside: Setting pch does not seem to be supported in type_summary?

Ngôn ngữ chính
R
Star
430
Fork
24
Merge trung bình
14 giờ 17 phút
Pull request đã merge (30 ngày)
8

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

  • Không có Dockerfile hay tệp Docker Compose
  • Không có mẫu pull request
  • Không có 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.

Issue khác của grantmcdermott/tinyplot

Tất cả issue của grantmcdermott/tinyplot

Issue tương tự

Thêm issue về R

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.