Supporting arrows with add_segments in plot_geo
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- R
- Sterne
- 2.7k
- Forks
- 641
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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:

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

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
)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Das bereitgestellte R-Beispiel mit plot_geo und add_segments reproduzieren, einschließlich der gekrümmten Flugpfade und Endpunktmarkierungen. Untersuche, wie gekrümmte Segmente gerendert werden und ob die Pfeilgeometrie ihrer Richtung folgen kann. Als erledigt gilt, wenn plot_geo gekrümmte Pfeile mit korrekt ausgerichteten Pfeilspitzen darstellen kann.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- r
- Bereich
- data-visualization
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100