#!/usr/bin/env python # coding: utf-8 # # Param `geodesic` in `geom_segment()` and `geom_path()` # # With `geodesic=True` a segment will be transformed to a curve representing the shortest path between two points on the surface of Earth. # # Note that this parameter only works when functions `geom_path()` and `geom_segment()` are used in combination with `geom_livemap()`. # In[1]: import pandas as pd from lets_plot import * # In[2]: LetsPlot.setup_html() # In[3]: LetsPlot.set(maptiles_lets_plot(theme='dark')) # #### By Default, a Segment on Map is a Straight Line # # In[4]: ggplot() + geom_livemap() + \ geom_segment(x=-122.25165, y=37.464958, xend=139.4130, yend=35.4122, color='white', size=1) # #### Segment with `geodesic=True` # With `geodesic=True` a segment on map becomes an arc. # In[5]: ggplot() + geom_livemap() + \ geom_segment(x=-122.25165, y=37.464958, xend=139.4130, yend=35.4122, geodesic=True, color='white', size=1) # #### `geom_path()` with `geodesic=True` # # In[6]: data = { 'city': ['New York', 'San-Francisco', 'Tokyo'], 'lon': [-73.935242, -122.25165, 139.4130], 'lat': [40.730610, 37.464958, 35.4122], } ggplot(data) + \ geom_livemap() + \ geom_path(aes(x='lon', y='lat'), color='white', size=1, linetype="dotted") + \ geom_path(aes(x='lon', y='lat'), geodesic=True, color='white', size=1)