Skip to content

Add support for ggrepel::geom_text_repel labels #2283

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
CristianRiccio opened this issue Aug 4, 2023 · 0 comments
Open

Add support for ggrepel::geom_text_repel labels #2283

CristianRiccio opened this issue Aug 4, 2023 · 0 comments

Comments

@CristianRiccio
Copy link

CristianRiccio commented Aug 4, 2023

I would like to produce a scatter plot in HTML format where labels are associated with each point.

This works well when I export the plot in PDF or PNG format:
example_repel_labels

But my HTML does not have the labels associated with each point. The warning message suggests that plotly does not support the label geometry from the ggrepel package:
example_repel_labels_html_screenshot

Would someone be so kind so add support for this function, please?

data(iris)

library(ggplot2)
library(htmlwidgets)
library(plotly)

p <- ggplot2::ggplot(iris, ggplot2::aes(x = Sepal.Length, y = Petal.Length)) +
  ggplot2::geom_point() +
  ggrepel::geom_text_repel(ggplot2::aes(label = Species)) +
  ggplot2::theme_classic()
ggplot2::ggsave('output/plot/point/example_repel_labels.pdf', p, height = 15, width = 15)
ggplot2::ggsave('output/plot/point/example_repel_labels.png', p, height = 15, width = 15)
pPlotly <- plotly::ggplotly(p)
htmlwidgets::saveWidget(pPlotly, 'output/plot/point/example_repel_labels.html')

Output:
Warning message: 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

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

1 participant