#!/usr/bin/env python # coding: utf-8 # # Geodesic lines on livemap: `flat` parameter. # # # Parameter `flat` enables or disables geodesic lines on livemap. # # Layers that support `flat` parameter are `geom_segment()` and `geom_path()`: # # - `False` (by default) - allows projection to curve a line # - `True` - keeps a line flat # In[1]: from lets_plot import * # In[2]: LetsPlot.setup_html() # In[3]: data = { 'lon': [-73.7997, -149.9002], 'lat': [40.6408, 61.2180], } # #### 1. Default Presentation # # By default a geodesic is drawn for `geom_path()` and `geom_segment()` on livemap. It is the shortest path between points on earth. # In[4]: ggplot(data, aes(x='lon', y='lat')) + \ geom_livemap() + \ geom_path() # #### 2. With flat=True # # If it is necessary to indicate distances for example, travel routes, a straight line is better. This is how `geom_path()` is rendered with parameter `flat=True` on livemap. # In[5]: ggplot(data, aes(x='lon', y='lat')) + \ geom_livemap() + \ geom_path(flat=True)