plotly / plotly/plotly.R

pies and subplot not working as expected

未關閉
#655 4 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
R
星號
2.7k
分支
641
PR 合併指標
30 天內沒有已合併 PR

描述

Based on this StackOverflow post, it seems pie charts are not working as I would expect with subplot. I will admit though that this is my first ever attempt at pie charts in Plotly. I did verify by inspecting DOM that both pies do exist in the examples below.

    # devtools::install_github('ropensci/plotly")

    library(plotly)
    ds_r <- data.frame(labels1 = c("Baseline", "DTC", "Detailing", "Flex"),
                       values1 = c(63.5, 8.5, 20.6, 7.4))

    ds_l <- data.frame(labels2 = c("Baseline"),
                       values2 = c(100))

    p <- plot_ly(
      ds_r, labels = ~labels1, values = ~values1, type = "pie", 
      showlegend = F
    )

    p2 <- plot_ly(
      ds_l,labels = ~labels2, values = ~values2, type = "pie", 
      showlegend = F
    )


    subplot(p, p2, nrows = 1)

image

empty axes

    # devtools::install_github('ropensci/plotly")
    # an "empty" plotlyjs axis for layout
    emptyAxis <- list(
      title = "", 
      zeroline = FALSE,
      showline = FALSE, 
      showticklabels = FALSE, 
      showgrid = FALSE
    )

    p <- plot_ly(
      ds_r, labels = ~labels1, values = ~values1, type = "pie", 
      showlegend = F
    ) %>% layout(xaxis = emptyAxis, yaxis  = emptyAxis)

    p2 <- plot_ly(
      ds_l,labels = ~labels2, values = ~values2, type = "pie", 
      showlegend = F
    ) %>% layout(xaxis = emptyAxis, yaxis  = emptyAxis)


    subplot(p, p2, nrows = 1)

image

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

首先使用 plot_ly() 和 subplot() 執行兩個可重現的範例,分別測試有和沒有空白座標軸配置的情況。追蹤 subplot() 如何指派 pie traces 和座標軸;當兩個圓餅圖不需要空白座標軸即可正確並排轉譯時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
r
領域
data-visualization
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。