plotly / plotly/plotly.R

GeomTextRepel() kicking error in plot_ly

未关闭
#1,809 3 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
R
星标
2.7k
派生
641
PR 合并指标
30 天内没有已合并 PR

描述


Trying to add labels to a plot_ly chart with GeomTextRepel() from ggrepel packge but am getting this error:

"Warning in geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) :
geom_GeomTextRepel() has yet to be implemented in plotly.
If you'd like to see this geom implemented,
Please open an issue with your example code at
https://github.com/ropensci/plotly/issues"

.... so here I am lol Another issue is that the labels aren't actually showing up... but I'm assuming that's due to the apparent lack of coordination between geomtextrepel and plot_ly

 
AHR_data <-  read_csv(file = "Final_AHR_Report.csv", col_names = TRUE)

fluidRow(
                                  box(
                                    width = 12,
                                    status = "warning",
                                    plotlyOutput("National_Line")
                                  ),
                                )
                                ),


output$National_Line <- renderPlotly({ 
    
    AHR_data_filtered <- reactive({
      AHR_data %>% 
        select(States, Year, input$Variables) %>% 
        group_by(Year) %>% 
        summarise(mean = mean(get(input$Variables)))
    })
    
      p <- AHR_data_filtered() %>%
      ggplot(aes(x = Year, y = mean, label=mean, group=1)) +
      geom_line() +
      geom_point(color = "Orange", size = 3) +
      geom_text_repel() +
      ylab(paste(as.character(input$Variables), "National Average")) +
      xlab("Year")
      ggplotly(p)
      
  })

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 geom2trace.default 入手,使用提供的 ggplotly 示例,检查不受支持的 GeomTextRepel 图层是如何处理的。对比现有的 geom 转换,然后验证该示例能够生成可见标签,且不会出现不受支持的 geom 警告。

由索引模型根据 Issue 内容生成。

评估

技术栈
r
领域
data-visualization
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。