plotly / plotly/plotly.R

Legend "entrywidth" and "entrywidthmode" parameters appear to be ignored when knitting Rmd to HTML

Đang mở
#2,215 1 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ả

I'm trying to use plotly to plot several stacked barplots of the same size each. Each barplot has legend elements of increasing size, and I would like to set the dimensions of the legend box, instead of the legend box being the size of the longest legend element. I've found the parameters entrywidth and entrywidthmode and tried using them to set this graphic setting, but the plots look exactly the same independently on what values I use.

The data looks like this:

> head(rel_table_filtered)
                                Class Relative_frequency  Sample
3      Bacteria;Bacteria;Unclassified        0.001547047 ileum_A
4  Bacteria;Bacteria;Actinobacteriota        0.137521410 ileum_A
5      Bacteria;Bacteria;Bacteroidota        0.111055859 ileum_A
8  Bacteria;Bacteria;Desulfobacterota        0.011989613 ileum_A
9        Bacteria;Bacteria;Firmicutes        0.707497652 ileum_A
11   Bacteria;Bacteria;Proteobacteria        0.025857782 ileum_A

The function simplified function I'm using to plot the barplots is the following. Wheter I put 0.9, 0.5, 1/8, etc, on the entrywitdthmode parameter, the plot looks the same. I've also tried with autosize=FALSE and with height and width parameters on the plot_ly function, without success.

fig <- plot_ly(rel_table_filtered, type = "bar", y = ~Sample, x= ~Relative_frequency, color = ~Class, orientation = "h") %>%
    layout( barmode = 'stack', xaxis = list(title = ''), yaxis = list(title = '%'), autosize = T, legend = list(entrywidthmode = "fraction", entrywidth = 0.9), hoverlabel = list(namelength=-1) )

fig

image

I'm attaching the rel_table_filtered.csv file:
rel_table_filtered.csv

Thanks in advance!

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ụ bằng plot_ly và layout với legend entrywidth và entrywidthmode, sau đó knit Rmd thành HTML và so sánh các giá trị tham số khác nhau. Kiểm tra rel_table_filtered.csv đính kèm và hành vi của chú giải được render; được xem là hoàn tất khi các tham số này trực quan điều khiển kích thước của hộp chú giải trong đầu ra được knit.

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
45/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.