Ggplotly does not always make a legend correctly for where there are points and lines
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
Ggplotly does not always make a legend correctly for where there are points and lines. Sometimes it only makes the legend key based on either geom_point or geom_line, whichever is the first layer. Below is an example where it doesn't work. It seems to fix it if the data is arranged by the x variable. It'd be good if it worked for however the data was arranged.
library(dplyr)
library(ggplot2)
library(plotly)
#This doesn't work: the legend is based only on the first geom shape
plot_data <- iris %>%
as_tibble() %>%
janitor::clean_names()
plot <- ggplot(data = plot_data, aes(petal_width, petal_length, col = species)) +
geom_point() +
geom_line()
plotly::ggplotly(plot)

plot_data <- iris %>%
as_tibble() %>%
janitor::clean_names() %>%
arrange(petal_width)
plot <- ggplot(data = plot_data, aes(petal_width, petal_length, col = species)) +
geom_point() +
geom_line()
plotly::ggplotly(plot)

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
Inizia riproducendo l’esempio R fornito con plotly::ggplotly, confrontando i dati iris non ordinati con la versione ordinata per petal_width. L’issue è completata quando la legenda rappresenta correttamente sia il livello dei punti sia quello delle linee, indipendentemente dall’ordine delle righe dei dati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- r
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100