subplot() with bar and pie chart creates unnecessary attribute and warning
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 42/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- plotly, r
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Chạy ví dụ R có thể tái lập và kiểm tra plotly_json(combined_chart), tập trung vào layout do subplot tạo ra và đối tượng NA2 không mong đợi. Truy vết cách subplot kết hợp các layout của biểu đồ cột và biểu đồ tròn; hoàn tất khi ví dụ được render mà không có cảnh báo nào trong hai cảnh báo và không có thuộc tính layout không cần thiết.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I'm trying to make a single chart that has both a bar chart and a relevant pie using subplot(). Subplot is optimal because I'd like the users to be able to screenshot both charts at once. Here is the code:
library(dplyr)
library(plotly)
bar_info <- data.frame(
Group = rep(c("first", "second", "third"), 2),
values_monthly = c(100, 200, 300, 400, 500, 600),
month = rep(c("April", "May"), each = 3) %>% as.factor()
)
pie_info <- group_by(bar_info, Group) %>%
summarise(values_total = sum(values_monthly))
colors = c("red", "blue", "yellow")
bar_chart <- plot_ly(bar_info, type = "bar",
x = ~ month, y = ~ values_monthly, color = ~Group,
colors = colors)
pie_chart <- plot_ly(pie_info, type = "pie",
labels = ~Group, values = ~values_total,
marker = list(colors = colors),
# setting up pie to the right
domain = list(x = c(0.9, 1), y = c(0,1)),
showlegend = F
)
combined_chart <- subplot(bar_chart, pie_chart, nrows = 1,
widths = c(0.9, 0.1))
combined_chart
Now, the most important thing, the chart looks as it should.
However, it displays these warnings:
Warning messages:
1: Can't display both discrete & non-discrete data on same axis
2: 'layout' objects don't have these attributes: 'NA'
Valid attributes include:
'_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'smith', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
How can I get rid of them? I've tried using shareX and shareY set to F or using add_trace for the pie, no help.
When I open the JSON with plotly_json(combined_chart), I can see that the layout object has a new, unneeded object NA2. This is probably related to the problem.
- 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
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.
Issue khác của plotly/plotly.R
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
-
Data gets dropped in add_trace and consequently points have the wrong color if NA is present Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
-
save_image Error Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
Tất cả issue của plotly/plotly.R
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
r-lib/pkgdepends#485 · 3 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
beginners blocker
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
enviPathR Đang mởBuild Error Build OK Build Warning policies-accepted pre-review precheck-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Bioconductor/BiocContributions#207 · 6 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
datacarpentry/semester-biology#1255 ·