Skip to content

adding example for multiple disconnected lines #2215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 4, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions doc/python/lines-on-maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,33 @@ fig.update_layout(

fig.show()
```
### High performance US Flight Paths Map
If you can relinquish having individual styles for the flight paths (e.g. opacity), you can put multiple paths into one trace, which makes the map render much faster.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About the wording I'm hesitating between faster and much faster here... Do you have orders of magnitude for the two solutions?


Use ```None``` between path coordinates to create a break in the otherwise connected paths.

```python
# ... omitted code: look at the previous "US Flight Paths Map" example
lons = []
lats = []
for i in range(len(df_flight_paths)):
# None interrupts lines and makes it possible to draw multiple disconnected lines.
lons += [df_flight_paths['start_lon'][i], df_flight_paths['end_lon'][i], None]
lats += [df_flight_paths['start_lat'][i], df_flight_paths['end_lat'][i], None]

fig.add_trace(
go.Scattergeo(
locationmode = 'USA-states',
lon = lons,
lat = lats,
mode = 'lines',
line = dict(width = 1,color = 'red'),
opacity = 0.5
)
)
# ... omitted code: look at the previous "US Flight Paths Map" example
```


### London to NYC Great Circle

Expand Down