plotly / plotly/plotly.R

Add support for ggrepel::geom_text_repel labels

Offen
#2,283 0 Kommentare 5 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
R
Sterne
2.7k
Forks
641
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie beim in der Warnung genannten geom2trace.default-Einstiegspunkt und reproduzieren Sie das bereitgestellte R-Beispiel mit geom_text_repel. Die Aufgabe ist erledigt, wenn plotly::ggplotly die Beschriftungen im gespeicherten HTML rendert, ohne zu melden, dass GeomTextRepel nicht unterstützt wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
r
Bereich
data-visualization
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.