plotly / plotly/plotly.R

Supporting arrows with add_segments in plot_geo

Aperta
#1,115 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

plotly.js
Lingua principale
R
Stelle
2.7k
Fork
641
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I like how the line is showing as curved when using add_segments in plot_geo.
However, using plot_geo, it is difficult to show the movement/direction.
Would it be possible to draw curved arrows instead of curved lines?
I tried adding triangular markers at the end of the line, but this looks ugly since triangles are not oriented correctly:
image

I was hoping we could get something like this except with curved arrows:
image

Here is the code I used to generate the first plot:

library(plotly)
library(dplyr)

flights <- read.csv('https://raw.githubusercontent.com/plotly/datasets/master/2011_february_aa_flight_paths.csv')
flights$id <- seq_len(nrow(flights))

geo <- list(
  scope = 'world',
  projection = list(type = 'equirectangular'),  #equirectangular, natural earth, orthographic, kavrayskiy7, miller
  showland = TRUE,
  showcountries = TRUE,
  landcolor = toRGB("gray95"),
  countrycolor = toRGB("gray80")
)

p <- plot_geo(
  locationmode = 'USA') %>%
  layout(geo = geo) %>%
  add_segments(
    data = flights, 
    x = ~start_lon, xend = ~end_lon,
    y = ~start_lat, yend = ~end_lat,
    alpha = 0.3,
    color = ~airport2,
    size = I(2.5),
    hoverinfo = "none"
  ) %>%
  add_markers(
    # data = my_segments %>% 
    #   filter(Family == fam & Units != 0 & From != To),
    data = flights, 
    x = ~end_lon,
    y = ~end_lat,
    color = ~airport2,
    size = 1,
    marker = list(symbol = 'triangle-up'),
    alpha = 1
  )

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riprodurre l’esempio R fornito usando plot_geo e add_segments, incluse le traiettorie di volo curve e i marcatori degli endpoint. Analizzare come vengono renderizzati i segmenti curvi e se la geometria delle frecce può seguirne la direzione. Il lavoro è completato quando plot_geo può visualizzare frecce curve con punte delle frecce orientate correttamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
r
Ambito
data-visualization
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.