geom_xspline not implemented in plotly - getting error message when using ggplotly() function
Nessuno ha ancora preso questa issue.
- Lingua principale
- R
- Stelle
- 2.7k
- Fork
- 641
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I get an error message when trying to implement geom_xspline with
plotly.
I get the desired graph in ggplot2 but the plot cannot be converted to a
plotly object when using the ggplotly function.
You can find the code showcasing this below.
library(pacman)
pacman::p_load(tidyverse, datasets, plotly, ggplotly, ggalt)
# airmiles built-in dataset:
airmiles <- datasets::airmiles
year <- 1937:1960
airmiles <- data.frame(year = year, airmiles = airmiles)
# "line" plot using geom_xspline from ggalt package:
plot_airmiles <- ggplot(data = airmiles,
aes(x = year, y = airmiles)) +
geom_point(alpha = 0.75) +
geom_xspline(spline_shape = -0.7) +
scale_y_continuous(n.breaks = 10)
plot_airmiles
# interactive plot: using ggplotly doesn't work
ggplotly(plot_airmiles)
Could this be implemented in plotly? Is there any way I can still
produce the interactive graph in plotly without waiting for this to be
implemented?
The plotly documentation (https://linking.plotly-r.com/custom-geoms)
mentions the possibility of creating custom geoms and using the
to_basic() function from the plotly package to “convert” the custom geom
into a geom plotly understands.
In the link above, the authors provide an example for geom_xspline
specifically but their method and code don’t work unfortunately.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci il problema con l’esempio airmiles fornito, geom_xspline e ggplotly(). Leggi la documentazione di custom-geoms collegata nell’issue, quindi esamina l’approccio to_basic() descritto lì. Il lavoro è completato quando geom_xspline può essere convertito in un oggetto plotly, oppure quando vengono documentati il limite supportato e il workaround.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- r
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100