{ "cells": [ { "cell_type": "markdown", "id": "8f9ded50", "metadata": {}, "source": [ "# Controlling lines curvnes on a livemap with `flat` parameter.\n", "\n", "Parameter `flat` is a replacement for the deprecated `geodesic` parameter of the livemap layer. \n", "Layers that support this parameter: `geom_segment()`, `geom_path()`:\n", "- `False` (by default) - allows a line to get geodesic;\n", "- `True` - keeps a line straight." ] }, { "cell_type": "code", "execution_count": 1, "id": "e6fabcbd", "metadata": {}, "outputs": [], "source": [ "from lets_plot import *" ] }, { "cell_type": "code", "execution_count": 2, "id": "5c0be31c", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 3, "id": "e09adfa5", "metadata": { "scrolled": true }, "outputs": [], "source": [ "data = {\n", " 'lon': [-73.7997, -149.9002],\n", " 'lat': [40.6408, 61.2180],\n", "}" ] }, { "cell_type": "code", "execution_count": 4, "id": "cea9383b", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ggplot(data, aes(x='lon', y='lat')) + \\\n", " geom_livemap() + \\\n", " geom_path(flat=True, color='red')" ] }, { "cell_type": "code", "execution_count": 5, "id": "f34cb543", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ggplot(data, aes(x='lon', y='lat')) + \\\n", " geom_livemap() + \\\n", " geom_path(flat=True, color='red') + \\\n", " geom_path(flat=False, color='blue')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.13" } }, "nbformat": 4, "nbformat_minor": 5 }