Skip to content

GeomTextRepel() kicking error in plot_ly #1809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
spurnell opened this issue Jul 2, 2020 · 3 comments
Open

GeomTextRepel() kicking error in plot_ly #1809

spurnell opened this issue Jul 2, 2020 · 3 comments

Comments

@spurnell
Copy link

spurnell commented Jul 2, 2020


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)
      
  })
@agnesbrnb
Copy link

Hello,

I just had the same issue and I can't find a way to avoid label overlapping in plotly without ggrepel. It could be a great idea to implement geom_text_repel() in plot_ly.
Is there any function/option to avoid overlapping when using add_text() from plotly ?

Thanks

@spurnell
Copy link
Author

spurnell commented Jul 9, 2020

Hi Agnes,

I'm sorry, I have not resolved the issue yet :/ I will comment here if I figure something out in the future.

Spence

@llrs
Copy link

llrs commented Aug 30, 2023

I also found this problem. There are three open (duplicated) issues about this #2283 and #1938 and several closed such as #2018.

In 2016 it was mentioned in #566 that the maintainers "don't plan on working on anytime soon". I don't know if there have been any update on that policy... given the popularity of ggrepel, plotly and the time between these comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants