plotly / plotly/plotly.R

add_annotations doesn't respect log scale

Offen
#1,743 3 Kommentare 1 Reaktion 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

When using add_annotations with a log scale, the coordinates of the annotations are not automatically log-transformed.

exp_dat <- data.frame(x = 0:100, 
                      y = exp(0:100))
ann_dat <- data.frame(x = c(1, 10, 100), 
                      y = exp(c(1, 10, 100)),
                      label = c(1, 10, 100))

plot_ly(type = "scatter", mode = "lines+markers") %>%
  add_lines(., data = exp_dat, x = ~x, y = ~y) %>%
  add_annotations(., data = ann_dat, x = ~x, y = ~y, text = ~label) %>%
  layout(., yaxis = list(type = "log"))

The desired result can be obtained by manually log-transforming the coordinates, but it would be more intuitive if this wasn't necessary.

plot_ly(type = "scatter", mode = "lines+markers") %>%
  add_lines(., data = exp_dat, x = ~x, y = ~y) %>%
  add_annotations(., data = ann_dat, x = ~x, y = ~log10(y), text = ~label) %>%
  layout(., yaxis = list(type = "log"))

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

Reproduziere das bereitgestellte R-Beispiel mit add_annotations und einer logarithmischen y-Achse und untersuche dann den Einstiegspunkt von add_annotations und dessen Verarbeitung von Annotierungskoordinaten. Erledigt ist dies, wenn die Annotationen auf der logarithmischen Skala korrekt ausgerichtet sind, ohne die y-Werte manuell zu transformieren.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
r
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

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