Lines on maps with PlotlyJS

Hi Leonard, Here is how I would translate that example:

using PlotlyJS, DataFrames, CSV

nm = tempname()
url = "https://raw.githubusercontent.com/plotly/datasets/c34aaa0b1b3cddad335173cb7bc0181897201ee6/2011_february_aa_flight_paths.csv"
download(url, nm)
cord = CSV.read(nm,DataFrame)

M = maximum(cord[:,:cnt])

trace_data = [ scattergeo(;locationmode="USA-states",
    lon = [cord[i,:start_lon], cord[i,:end_lon]],
    lat = [cord[i,:start_lat], cord[i,:end_lat]],
    mode = "lines",
    line_width = 2,
    line_color = "red",
    opacity = cord[i,:cnt]/M
) for i in 1:nrow(cord)];

geo = attr(scope="north america",
    projection_type="azimuthal equal area",
    showland=true,
    landcolor="rgb(243,243,243)",
    countrycolor="rgb(204,204,204)",
    subunitwidth=1,
    countrywidth=1,
)

layout = Layout(;title="Feb. 2011 American Airline flight paths", showlegend=false, geo=geo)
plot(trace_data, layout)
1 Like