plotly / plotly/plotly.R

GeomTextRepel() kicking error in plot_ly

Open
#1,809 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description


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)
      
  })

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at geom2trace.default with the supplied ggplotly example and inspect how the unsupported GeomTextRepel layer is handled. Compare existing geom conversions, then verify that the example produces visible labels without the unsupported-geom warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.