Supporting arrows with add_segments in plot_geo
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
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
)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the supplied R example using plot_geo and add_segments, including the curved flight paths and endpoint markers. Investigate how curved segments are rendered and whether arrow geometry can follow their direction. Done means plot_geo can display curved arrows with correctly oriented arrowheads.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100