From f5aa0cf7c34ef15304a9327653758c3dc2322ff4 Mon Sep 17 00:00:00 2001 From: Frank <33519926+Conengmo@users.noreply.github.com> Date: Wed, 3 Apr 2024 12:47:06 +0200 Subject: [PATCH] Remove one more deprecated example notebook --- docs/user_guide/plugins/heatmap_with_time.md | 2 +- examples/HeatMapWithTime.ipynb | 538 +------------------ 2 files changed, 6 insertions(+), 534 deletions(-) diff --git a/docs/user_guide/plugins/heatmap_with_time.md b/docs/user_guide/plugins/heatmap_with_time.md index 13fe51954..956759a51 100644 --- a/docs/user_guide/plugins/heatmap_with_time.md +++ b/docs/user_guide/plugins/heatmap_with_time.md @@ -6,7 +6,7 @@ import folium import folium.plugins ``` -# HeatMapWithTime Plugin +# HeatMapWithTime In this example we show the basic usage of the HeatMapWithTime plugin. diff --git a/examples/HeatMapWithTime.ipynb b/examples/HeatMapWithTime.ipynb index 743385ec9..f3e727004 100644 --- a/examples/HeatMapWithTime.ipynb +++ b/examples/HeatMapWithTime.ipynb @@ -2,541 +2,13 @@ "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 arranged 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 = np.random.normal(size=(100, 2)) * np.array([[1, 1]]) + np.array(\n", - " [[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)]" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Weights\n", - "\n", - "In order to control intensity shown on the map, each data entry needs to have a `weight`. Which should be between 0 and 1. \n", - "Below we generate weights randomly such that intensity increases over time. " - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "time_ = 0\n", - "N = len(data)\n", - "itensify_factor = 30\n", - "for time_entry in data:\n", - " time_ = time_+1\n", - " for row in time_entry:\n", - " weight = min(np.random.uniform()*(time_/(N))*itensify_factor, 1)\n", - " row.append(weight)" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
Make this Notebook Trusted to load map: File -> Trust Notebook
" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "m = folium.Map([48.0, 5.0], zoom_start=6)\n", - "\n", - "hm = plugins.HeatMapWithTime(data)\n", - "\n", - "hm.add_to(m)\n", - "\n", - "m" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Now we show that the time index can be specified, allowing a more meaningful representation of what the time steps mean. We also enable the 'auto_play' option and change the maximum opacity. See the docmentation for a full list of options that can be used." - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [], - "source": [ - "from datetime import datetime, timedelta\n", - "\n", - "time_index = [\n", - " (datetime.now() + k * timedelta(1)).strftime(\"%Y-%m-%d\") for k in range(len(data))\n", - "]" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
Make this Notebook Trusted to load map: File -> Trust Notebook
" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } + "We’ve updated our documentation and removed this notebook. \n", + "You can find the current documentation at https://python-visualization.github.io/folium/latest/user_guide/plugins/heatmap_with_time.html." ], - "source": [ - "m = folium.Map([48.0, 5.0], zoom_start=6)\n", - "\n", - "hm = plugins.HeatMapWithTime(data, index=time_index, auto_play=True, max_opacity=0.3)\n", - "\n", - "hm.add_to(m)\n", - "\n", - "m" - ] + "metadata": { + "collapsed": false + } } ], "metadata": {