Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Adding paths to scatterplot map

A few months ago I wrote code to add overlaid paths to a scatterplot map, and it worked fine. (The paths were unrelated to underlying scatterplot.) I tried running my code again (v 4.7.0) and it’s now broken. Plotly apparently wants the add_paths function to take data arguments with lengths equal to the number of scatterplot points. However, I want to draw superimposed lines that are unrelated to the underlying scatterplot. I’ve modified the “Basic Scatter on Map” example from https://plot.ly/r/scatter-plots-on-maps/ to demonstrate this issue:

library(plotly)
df <- read.csv('https://raw.githubusercontent.com/plotly/datasets/master/2011_february_us_airport_traffic.csv')

# geo styling
g <- list(
  scope = 'usa',
  projection = list(type = 'albers usa'),
  showland = TRUE,
  landcolor = toRGB("gray95"),
  subunitcolor = toRGB("gray85"),
  countrycolor = toRGB("gray85"),
  countrywidth = 0.5,
  subunitwidth = 0.5
)

p <- plot_geo(df, lat = ~lat, lon = ~long) %>%
  add_markers(
    text = ~paste(airport, city, state, paste("Arrivals:", cnt), sep = "<br />"),
    color = ~cnt, symbol = I("square"), size = I(8), hoverinfo = "text"
  ) %>%
  colorbar(title = "Incoming flights<br />February 2011") %>%
  layout(
    title = 'Most trafficked US airports<br />(Hover for airport)', geo = g
  ) 

p # works fine

# latitude and longitude data for drawing line 
line.lng = seq(-116,-55,length.out = 25)
line.lat = seq(56,48,length.out = 25)

p %>% add_paths(x=~line.lng,y=~line.lat,
            line=list(color="62037d",
                      width=8,
                      dash="solid"))
# throws error, saying that the lat/lon data supplied to 
# add_paths has to be the same length as the number of data points
# on the underlying scatterplot - this did not happen in an earlier version

Any suggestions would be greatly appreciated.