Cannot have more than one shape after subplot()
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 guess this is related to #1333
Here is the issue: it doesn't seem possible to have more than one shape after subplot() is called. Applying the shapes to the individual plots work, though.
reprex that works:
library(plotly)
p1 <- plot_ly(mtcars, x = ~mpg, y = ~hp) %>%
layout(
shapes = list(
list(
type = "line",
line = list(color = "#5681c4", dash = "dot"),
x0 = 20,
x1 = 20,
y0 = 0,
y1 = 1,
yref = "paper"
),
list(
type = "line",
line = list(color = "#5681c4", dash = "solid"),
x0 = 30,
x1 = 30,
y0 = 0,
y1 = 1,
yref = "paper"
)
)
) %>%
config(editable = TRUE)
p2 <- plot_ly(mtcars, x = ~mpg, y = ~drat) %>%
layout(
shapes = list(
list(
type = "line",
line = list(color = "#5681c4", dash = "dot"),
x0 = 20,
x1 = 20,
y0 = 0,
y1 = 1,
yref = "paper"
),
list(
type = "line",
line = list(color = "#5681c4", dash = "solid"),
x0 = 30,
x1 = 30,
y0 = 0,
y1 = 1,
yref = "paper"
)
)
) %>%
config(editable = TRUE)
subplot(p1, p2, nrows = 2)
reprex that does not work:
library(plotly)
p1 <- plot_ly(mtcars, x = ~mpg, y = ~hp)
p2 <- plot_ly(mtcars, x = ~mpg, y = ~drat)
subplot(p1, p2, nrows = 2) %>%
layout(
shapes = list(
list(
type = "line",
line = list(color = "#5681c4", dash = "dot"),
x0 = 20,
x1 = 20,
y0 = 0,
y1 = 1,
yref = "paper"
),
list(
type = "line",
line = list(color = "#5681c4", dash = "solid"),
x0 = 30,
x1 = 30,
y0 = 0,
y1 = 1,
yref = "paper"
)
)
) %>%
config(editable = TRUE)
reprex with only one shape - it works:
library(plotly)
p1 <- plot_ly(mtcars, x = ~mpg, y = ~hp)
p2 <- plot_ly(mtcars, x = ~mpg, y = ~drat)
subplot(p1, p2, nrows = 2) %>%
layout(
shapes = list(
type = "line",
line = list(color = "#5681c4", dash = "dot"),
x0 = 20,
x1 = 20,
y0 = 0,
y1 = 1,
yref = "paper"
)
) %>%
config(editable = TRUE)
Any thoughts?
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die funktionierenden und fehlschlagenden Reprexes im Issue auszuführen und die Shapes zu vergleichen, die jedem Plot übergeben werden, mit den Shapes, die nach subplot() hinzugefügt werden. Verfolge, wie subplot() die Plots kombiniert und wie der spätere Aufruf layout(shapes = ...) verarbeitet wird. Erledigt ist die Aufgabe, wenn beide Shapes im Subplot gerendert werden und mit config(editable = TRUE) bearbeitbar bleiben.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- r
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100