{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# HeatMapWithTime Plugin" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this example we show the most basic usage of the HeatMapWithTime plugin.\n", "\n", "We generate a random set of points with lat/lon coordinates to draw on the map, and then move these points slowly in a random direction to simulate a time dimension. The points are aranged into a list of sets of data to draw." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import folium\n", "import folium.plugins as plugins\n", "import numpy as np\n", "\n", "np.random.seed(3141592)\n", "initial_data = (\n", " np.random.normal(size=(100, 2)) * np.array([[1, 1]]) +\n", " np.array([[48, 5]])\n", ")\n", "\n", "move_data = np.random.normal(size=(100, 2)) * 0.01\n", "\n", "data = [(initial_data + move_data * i).tolist() for i in range(100)]\n", "\n", "weight = 1 # default value\n", "for time_entry in data:\n", " for row in time_entry:\n", " row.append(weight)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "