Cannot have more than one shape after subplot()
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- R
- Estrellas
- 2.7k
- Forks
- 641
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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?
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza ejecutando los reprexes que funcionan y los que fallan en el issue, comparando las shapes suministradas a cada plot con las shapes añadidas después de subplot(). Rastrea cómo subplot() combina los plots y cómo se gestiona la llamada posterior a layout(shapes = ...). La tarea estará terminada cuando ambas shapes se rendericen en el subplot y sigan siendo editables con config(editable = TRUE).
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- r
- Área
- data-visualization
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100