Skip to content

GeomTextRepel() kicking error in plot_ly #1809

Open
@spurnell

Description

@spurnell

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions