plotly / plotly/plotly.R

Plot shrank or expanded when activating or deactivating legend keys

未關閉
#2,003 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

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

描述

Basically, when I double-clicked on the legend keys to activate or deactive them, the plot shrank or expanded. I posted the issue on StackOverflow and the user mnist found that it was the empty string that caused the problem.

Here is the reprex

p <- ggplot(mpg, aes(x = displ, y = hwy, color = factor(cyl), shape = class)) +
geom_point(size = 3) +
    scale_color_manual(values = c("4" = "#abd9e9",
                                  "5" = "#2c7bb6",
                                  "6" = "#ff7f00",
                                  "8" = "#d7191c")) +
    scale_shape_manual(values = c(2, 5, 16, 17, 18, 19, 25)) +
    guides(color = guide_legend(title = "Cyl", order = 1),
           shape = guide_legend(title = "", order = 2)) +
    theme_classic(base_size = 16)
p

ggplotly(p) %>%
    layout(xaxis = list(autorange = "reversed",
                        tickvals = c(2, 3, 5, 6),                        
                        ticktext = c("2", "", "5", "6"))) 

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

首先使用 ggplotly 執行提供的 R reprex,並重現雙擊圖例鍵時圖表大小調整的情況。追蹤圖例啟用期間如何處理空的圖例標題或標籤,然後確認切換這些鍵不再改變圖表尺寸。

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

評估

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

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

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