plotly / plotly/plotly.R

geom_hline and geom_vline behave like a legend item when we apply filter

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

還沒有人認領這個 Issue。

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

描述

When we double click on a legend item to isolate it, the geom_hline and geom_vline lines are also hidden. They behave as legend items.

Related to Issue/696 ?

library("ggplot2")
library("plotly")

df = read.table(text = 
                  "id      year    value1  value2 value3
            1           2000    1   2000      2001
            1           2001    2   NA        NA
            1           2002    2   2000      NA
            1           2003    2   NA         2003
            2           2000    1   2001     2003
            2           2002    2   NA       2000
            2           2003    3   2002     NA
            3           2002    2   2001     NA
        ", sep = "", header = TRUE)
df$value1 <- as.factor(df$value1)

p <- ggplot(df, aes(y=id)) +
  geom_point(aes(x=year, color=value1), size=4) +
  geom_point(aes(x=value3, colour ='value3'), size=3) +
  geom_point(aes(x=value2, colour ='value2'), size=5) +
  geom_hline(yintercept=0) + geom_vline(xintercept=0) +
  scale_colour_manual(name="",  
                      values = c("1"="yellow", "2"="orange", "3"="red",
                                 "value3"="grey", "value2"="black"))


ply <- ggplotly(p)
ply

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

首先使用 ggplot2、plotly 和 ggplotly 執行提供的 R 重現程式碼,然後檢查透過雙擊圖例項目進行隔離會如何影響 geom_hline 和 geom_vline 圖層。當隔離某個圖例項目時,這些參考線仍保持可見,同時繪製的資料仍會回應圖例互動,即視為完成。

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

評估

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

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

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