{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "f3a32b1b-c1e8-4b8d-b749-c9364c7af968", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The geodata is provided by © OpenStreetMap contributors and is made available here under the Open Database License (ODbL).\n" ] }, { "data": { "text/html": [ "\n", " \n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import numpy as np\n", "from lets_plot import *\n", "from lets_plot.geo_data import *\n", "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 2, "id": "58478275-a3d6-4c7b-ab7e-7a9468eed37b", "metadata": {}, "outputs": [], "source": [ "cities = geocode_cities(['Berlin', 'Sankt-Peterburg', 'Washington', 'Mbarara'])" ] }, { "cell_type": "markdown", "id": "c1f79f8c-913d-4b38-a238-646b84ecdaba", "metadata": {}, "source": [ "#### The space between the point and the text is different for each object and gets bigger closer to the poles." ] }, { "cell_type": "code", "execution_count": 3, "id": "5b348087-af83-4b2b-b9f7-eeca2ef6bd3f", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ggplot() + geom_livemap() + geom_point(map=cities, color='red') + geom_text(aes(label='found name'), map=cities, nudge_y = 5, color='red')" ] }, { "cell_type": "markdown", "id": "91f86cd6-e32b-4fd7-97cc-598be86dd5da", "metadata": {}, "source": [ "#### When zooming with point scaling on, the text stays in the right place, but it does not scale." ] }, { "cell_type": "code", "execution_count": 4, "id": "56fa53ff-56e5-4a5e-8dfa-a4c96c49389d", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ggplot() + geom_livemap() + geom_point(map=cities, color='red') + geom_text(aes(label='found name'), map=cities, nudge_y = 1, color='red')" ] }, { "cell_type": "markdown", "id": "fdebc4fd-0d5e-4f9f-afd9-b8dc937a12e2", "metadata": {}, "source": [ "#### When zooming with point scaling off, it's good that the text doesn't scale. But the distance in pixels between the point and the text changes." ] }, { "cell_type": "code", "execution_count": 5, "id": "5073a767-4d76-414d-be24-7de32002c3fc", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ggplot() + geom_livemap(const_size_zoomin=0) + geom_point(map=cities, color='red') + geom_text(aes(label='found name'), map=cities, nudge_y = 1, color='red')" ] }, { "cell_type": "code", "execution_count": null, "id": "1e885988-3c3f-4f92-81ff-576fbcc7ead9", "metadata": {}, "outputs": [], "source": [] } ], "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.9.20" } }, "nbformat": 4, "nbformat_minor": 5 }