Cannot have more than one shape after subplot()
Personne n'a encore pris cette issue.
- Langage dominant
- R
- Étoiles
- 2.7k
- Forks
- 641
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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?
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par exécuter les reprexes qui fonctionnent et ceux qui échouent dans l’issue, en comparant les shapes fournies à chaque plot avec les shapes ajoutées après subplot(). Suivez la manière dont subplot() combine les plots et dont l’appel ultérieur à layout(shapes = ...) est traité. Le travail est terminé lorsque les deux shapes sont rendues dans le subplot et restent modifiables avec config(editable = TRUE).
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- r
- Domaine
- data-visualization
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100