plotly / plotly/plotly.R

Better support for trellis displays

Offen
#727 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

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

Beschreibung

There are a few different ways to do a trellis display currently, but these are all a bit esoteric

one_plot <- function(d) {
  plot_ly(d, x = ~wt, y = ~mpg)
}

mtcars %>%
  group_by(vs) %>%
  do(plot = one_plot(.)) %>%
  subplot(nrows = NROW(.))

plot_ly(mtcars, x = ~wt, y = ~mpg, color = ~factor(vs), yaxis = ~paste0("y", vs + 1)) %>%
  subplot(nrows = 2)

plot_ly(mtcars, x = ~wt, y = ~mpg, split = ~factor(vs), yaxis = ~paste0("y", vs + 1)) %>%
  subplot(nrows = 2)

#726 implements a trellis argument, which essentially maps that variable to sensible trace anchors, then uses subplot()'s machinery to populate axis objects. The problem is, we have guarantee a subplot is returned if we want a sensible result for:

plot_ly(mtcars, x = ~wt, y = ~mpg, trellis = ~vs)

Thus, we lose the ability to specify the number of rows in that subplot

It'd be better to have trellis() function:

trellis <- function(p, formula, ...) {
  # do some stuff here
  subplot(p, ...)
}

Ideally, the trellising would work a lot like ggplot2 facets (trellising variables should not appear in legends, and appear as annotations instead). This is what we do in ggplotly() via clever use of showlegend and legendgroup.

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

Überprüfe zuerst das in #726 vorgeschlagene trellis-Argument und die vorhandene subplot()-Mechanik. Eine vollständige Lösung sollte eine trellis()-Funktion bereitstellen, die die Kontrolle über die subplot-Zeilen beibehält und ein ggplot2-ähnliches Verhalten unterstützt, einschließlich des Ausschlusses der Trellising-Variablen aus den Legenden und ihrer Darstellung als Annotationen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
r
Bereich
data-visualization
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

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