{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "1f27e037-c8fc-4f57-bd10-0ec0f6eac855", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from math import sqrt\n", "\n", "import numpy as np\n", "import pandas as pd\n", "\n", "from lets_plot import *\n", "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 2, "id": "15a98a74-961c-4d5f-88f4-9014d23ec3b6", "metadata": {}, "outputs": [], "source": [ "lon_min, lon_max = -106.65, -93.51\n", "lat_min, lat_max = 0.0, 80.0\n", "num_points = 1000\n", "data = {\n", " 'lon': np.random.uniform(lon_min, lon_max, num_points),\n", " 'lat': np.random.uniform(lat_min, lat_max, num_points),\n", "}\n", "\n", "df = pd.DataFrame(data)" ] }, { "cell_type": "code", "execution_count": 3, "id": "b644ded7-e6f1-466c-897e-4efac7128fdd", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
lonlat
0-105.03463378.748055
1-101.61503665.380899
2-98.73262977.097753
3-98.30115545.695936
4-97.06051040.132365
.........
995-101.04222514.729542
996-105.19753353.561185
997-99.37884245.659620
998-104.27522139.222438
999-105.41528849.439561
\n", "

1000 rows × 2 columns

\n", "
" ], "text/plain": [ " lon lat\n", "0 -105.034633 78.748055\n", "1 -101.615036 65.380899\n", "2 -98.732629 77.097753\n", "3 -98.301155 45.695936\n", "4 -97.060510 40.132365\n", ".. ... ...\n", "995 -101.042225 14.729542\n", "996 -105.197533 53.561185\n", "997 -99.378842 45.659620\n", "998 -104.275221 39.222438\n", "999 -105.415288 49.439561\n", "\n", "[1000 rows x 2 columns]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df" ] }, { "cell_type": "code", "execution_count": 4, "id": "d2c9595a-11bb-4aec-815e-027a56c990a6", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ggplot(df, aes('lon', 'lat')) + geom_livemap() + geom_hex(binwidth=[2, 2])" ] }, { "cell_type": "code", "execution_count": 7, "id": "6feed1c4-35b3-4d5b-ba73-130fe674f32d", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ggplot(df, aes('lon', 'lat')) + geom_livemap(projection = 'conic') + geom_hex(binwidth=[2, 2])" ] }, { "cell_type": "code", "execution_count": 5, "id": "d561aba7-4f6f-482b-8b69-8d1f7bb6d63f", "metadata": {}, "outputs": [], "source": [ "#dump_plot(_)" ] } ], "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 }