plotly.R
plotly.R copied to clipboard
GeomTextRepel() kicking error in plot_ly
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)
})
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
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
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.