{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "54d23f3c-34cb-489a-b081-2c8b74b533b2", "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" ] } ], "source": [ "from lets_plot import *\n", "from lets_plot.geo_data import *" ] }, { "cell_type": "code", "execution_count": 2, "id": "bf529b2d-1a39-46e8-9db7-d65d6f5efe15", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "markdown", "id": "61304554-1994-47b2-bf0c-8ca6ef3dab53", "metadata": {}, "source": [ "##### Utils" ] }, { "cell_type": "code", "execution_count": 3, "id": "e4610759-1fdd-413e-8add-63ed82990591", "metadata": {}, "outputs": [], "source": [ "# to set up a projection using a non-public parameter\n", "from lets_plot.plot.coord import _coord as coord\n", "\n", "p = ggplot() + xlim(-180, 180) + ylim(-90, 90) + theme(axis=element_blank())\n", "\n", "def dump_plot(plot):\n", " import json\n", " import clipboard\n", " from lets_plot._type_utils import standardize_dict\n", " \n", " plot_dict = standardize_dict(plot.as_dict())\n", " plot_json = json.dumps(plot_dict, indent=2)\n", "\n", " clipboard.copy('')\n", " clipboard.copy(str(plot_json))\n", "\n", " return plot" ] }, { "cell_type": "code", "execution_count": 4, "id": "b485c37a-d668-4c04-bd05-70726c095952", "metadata": {}, "outputs": [], "source": [ "world = geocode_countries().get_boundaries(3)" ] }, { "cell_type": "code", "execution_count": 5, "id": "e02c58f8-2874-4bef-bd9a-c5d691e90481", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "