{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Data Collection" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "import requests\n", "import json\n", "import pandas as pd\n", "import numpy as np\n", "from geopy import geocoders\n", "from geopy.geocoders import Nominatim\n", "\n", "\n", "r = requests.get('https://statsapi.web.nhl.com/api/v1/game/2019021017/feed/live')\n", "\n", "def jprint(obj):\n", " # create a formatted string of the Python JSON object\n", " text = json.dumps(obj, sort_keys=True, indent=4)\n", " print(text)\n", "\n", "def geo(location):\n", " g = geocoders.Nominatim(user_agent='MSGT_Lab5', timeout=None)\n", " try:\n", " loc = g.geocode(location)\n", " return loc.latitude, loc.longitude\n", " except:\n", " return 0,0\n", "\n", "x = r.json()\n", "\n", "df = pd.DataFrame(x['liveData']['plays']['allPlays'])\n", "df\n", "\n", "data = x['liveData']['plays']['allPlays']\n", "data\n", "\n", "results_df = pd.json_normalize(data)\n", "results_df\n", "\n", "coords = df.iloc[:,2]\n", "\n", "events = df.iloc[:,0][3:]\n", "\n", "coords_df = pd.json_normalize(coords)\n", "coords_df\n", "\n", "\n", "event_df = pd.json_normalize(events)\n", "\n", "latitude = []\n", "longitude = []\n", "\n", "for i in coords:\n", " \n", " if coords_df['x'] is not None:\n", " \n", " lat = coords_df['y']\n", " lon = coords_df['x']\n", " for i in [lat]:\n", " latitude.append(i)\n", " for i in [lon]:\n", " longitude.append(i)\n", "\n", "coordinates_df = pd.DataFrame(list(zip(results_df['result.event'],results_df['result.description'],lat,lon)), columns = ['Event','Description','Lat','Lon'])\n", "\n", "coordinates_df = coordinates_df.dropna()\n", "\n", "coordinates_df\n", "\n", "coordinates_df.to_csv('events.csv', header = True, mode = 'a')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Mapbox & Plotly of Events" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hoverinfo": "text", "lat": [ "0.0", "-37.0", "38.0", "36.0", "15.0", "22.0", "21.0", "0.0", "-22.0", "-31.0", "-22.0", "-26.0", "-22.0", "40.0", "20.0", "27.0", "-16.0", "21.0", "22.0", "-7.0", "22.0", "-14.0", "9.0", "12.0", "1.0", "1.0", "0.0", "-13.0", "-22.0", "-22.0", "-16.0", "-28.0", "38.0", "-16.0", "28.0", "5.0", "-14.0", "39.0", "-12.0", "9.0", "6.0", "-41.0", "-40.0", "-38.0", "-22.0", "-29.0", "-6.0", "3.0", "-28.0", "22.0", "-12.0", "-7.0", "11.0", "-2.0", "0.0", "-22.0", "40.0", "7.0", "-1.0", "-25.0", "22.0", "-19.0", "-22.0", "34.0", "-12.0", "-22.0", "-20.0", "-37.0", "23.0", "-14.0", "-22.0", "5.0", "5.0", "22.0", "22.0", "-22.0", "8.0", "-42.0", "-10.0", "-6.0", "-13.0", "39.0", "9.0", "22.0", "27.0", "19.0", "-22.0", "17.0", "22.0", "-37.0", "-29.0", "0.0", "15.0", "22.0", "-25.0", "-15.0", "0.0", "31.0", "21.0", "22.0", "3.0", "31.0", "4.0", "-32.0", "-11.0", "0.0", "22.0", "28.0", "11.0", "-22.0", "-6.0", "-8.0", "-4.0", "-23.0", "26.0", "22.0", "4.0", "11.0", "-1.0", "22.0", "-17.0", "-13.0", "-3.0", "1.0", "-38.0", "-20.0", "-5.0", "22.0", "0.0", "0.0", "-22.0", "-22.0", "2.0", "12.0", "32.0", "-38.0", "-27.0", "-18.0", "-33.0", "-36.0", "0.0", "17.0", "22.0", "-29.0", "-22.0", "13.0", "-6.0", "-33.0", "-23.0", "-1.0", "0.0", "22.0", "13.0", "7.0", "22.0", "-17.0", "-10.0", "-40.0", "-28.0", "-22.0", "-32.0", "2.0", "21.0", "11.0", "-22.0", "1.0", "22.0", "-3.0", "0.0", "-1.0", "-28.0", "6.0", "-30.0", "22.0", "-38.0", "-39.0", "7.0", "-6.0", "27.0", "-33.0", "20.0", "3.0", "-5.0", "1.0", "-22.0", "23.0", "16.0", "-22.0", "-16.0", "7.0", "-16.0", "29.0", "5.0", "9.0", "0.0", "8.0", "-22.0", "-38.0", "-22.0", "-2.0", "-11.0", "-21.0", "-2.0", "-4.0", "-9.0", "3.0", "-40.0", "-22.0", "-22.0", "-6.0", "-6.0", "22.0", "0.0", "0.0", "0.0", "42.0", "-22.0", "-13.0", "-22.0", "5.0", "18.0", "22.0", "-1.0", "-9.0", "-33.0", "0.0", "-22.0", "-22.0", "5.0", "-1.0", "-22.0", "20.0", "-3.0", "37.0", "-22.0", "Lat", "0.0", "-37.0", "38.0", "36.0", "15.0", "22.0", "21.0", "0.0", "-22.0", "-31.0", "-22.0", "-26.0", "-22.0", "40.0", "20.0", "27.0", "-16.0", "21.0", "22.0", "-7.0", "22.0", "-14.0", "9.0", "12.0", "1.0", "1.0", "0.0", "-13.0", "-22.0", "-22.0", "-16.0", "-28.0", "38.0", "-16.0", "28.0", "5.0", "-14.0", "39.0", "-12.0", "9.0", "6.0", "-41.0", "-40.0", "-38.0", "-22.0", "-29.0", "-6.0", "3.0", "-28.0", "22.0", "-12.0", "-7.0", "11.0", "-2.0", "0.0", "-22.0", "40.0", "7.0", "-1.0", "-25.0", "22.0", "-19.0", "-22.0", "34.0", "-12.0", "-22.0", "-20.0", "-37.0", "23.0", "-14.0", "-22.0", "5.0", "5.0", "22.0", "22.0", "-22.0", "8.0", "-42.0", "-10.0", "-6.0", "-13.0", "39.0", "9.0", "22.0", "27.0", "19.0", "-22.0", "17.0", "22.0", "-37.0", "-29.0", "0.0", "15.0", "22.0", "-25.0", "-15.0", "0.0", "31.0", "21.0", "22.0", "3.0", "31.0", "4.0", "-32.0", "-11.0", "0.0", "22.0", "28.0", "11.0", "-22.0", "-6.0", "-8.0", "-4.0", "-23.0", "26.0", "22.0", "4.0", "11.0", "-1.0", "22.0", "-17.0", "-13.0", "-3.0", "1.0", "-38.0", "-20.0", "-5.0", "22.0", "0.0", "0.0", "-22.0", "-22.0", "2.0", "12.0", "32.0", "-38.0", "-27.0", "-18.0", "-33.0", "-36.0", "0.0", "17.0", "22.0", "-29.0", "-22.0", "13.0", "-6.0", "-33.0", "-23.0", "-1.0", "0.0", "22.0", "13.0", "7.0", "22.0", "-17.0", "-10.0", "-40.0", "-28.0", "-22.0", "-32.0", "2.0", "21.0", "11.0", "-22.0", "1.0", "22.0", "-3.0", "0.0", "-1.0", "-28.0", "6.0", "-30.0", "22.0", "-38.0", "-39.0", "7.0", "-6.0", "27.0", "-33.0", "20.0", "3.0", "-5.0", "1.0", "-22.0", "23.0", "16.0", "-22.0", "-16.0", "7.0", "-16.0", "29.0", "5.0", "9.0", "0.0", "8.0", "-22.0", "-38.0", "-22.0", "-2.0", "-11.0", "-21.0", "-2.0", "-4.0", "-9.0", "3.0", "-40.0", "-22.0", "-22.0", "-6.0", "-6.0", "22.0", "0.0", "0.0", "0.0", "42.0", "-22.0", "-13.0", "-22.0", "5.0", "18.0", "22.0", "-1.0", "-9.0", "-33.0", "0.0", "-22.0", "-22.0", "5.0", "-1.0", "-22.0", "20.0", "-3.0", "37.0", "-22.0" ], "lon": [ "0.0", "-73.0", "38.0", "61.0", "-75.0", "-69.0", "34.0", "49.0", "69.0", "55.0", "69.0", "85.0", "69.0", "71.0", "81.0", "64.0", "58.0", "-78.0", "69.0", "36.0", "69.0", "76.0", "-77.0", "-59.0", "-55.0", "-74.0", "0.0", "-99.0", "69.0", "69.0", "55.0", "56.0", "-17.0", "58.0", "30.0", "-46.0", "-97.0", "21.0", "68.0", "-36.0", "-49.0", "-19.0", "-56.0", "17.0", "69.0", "51.0", "70.0", "33.0", "93.0", "69.0", "63.0", "58.0", "42.0", "79.0", "0.0", "20.0", "47.0", "66.0", "75.0", "42.0", "69.0", "67.0", "69.0", "-85.0", "39.0", "69.0", "47.0", "36.0", "-10.0", "42.0", "69.0", "40.0", "74.0", "69.0", "-20.0", "-20.0", "-97.0", "-4.0", "72.0", "63.0", "-97.0", "39.0", "61.0", "69.0", "-60.0", "-95.0", "-69.0", "-84.0", "-20.0", "79.0", "45.0", "0.0", "-52.0", "-69.0", "-94.0", "66.0", "0.0", "89.0", "-49.0", "-69.0", "72.0", "92.0", "96.0", "87.0", "77.0", "68.0", "69.0", "91.0", "99.0", "49.0", "33.0", "66.0", "72.0", "76.0", "95.0", "69.0", "63.0", "59.0", "60.0", "69.0", "58.0", "64.0", "-66.0", "-71.0", "80.0", "46.0", "66.0", "96.0", "-67.0", "34.0", "41.0", "69.0", "-39.0", "-76.0", "60.0", "42.0", "93.0", "-77.0", "75.0", "83.0", "74.0", "39.0", "69.0", "-37.0", "-69.0", "-38.0", "-72.0", "91.0", "30.0", "-73.0", "0.0", "-20.0", "-14.0", "98.0", "20.0", "95.0", "-73.0", "-21.0", "-59.0", "-69.0", "-86.0", "-36.0", "-96.0", "-79.0", "-69.0", "-28.0", "69.0", "76.0", "0.0", "40.0", "-58.0", "-72.0", "-46.0", "20.0", "-41.0", "-77.0", "-78.0", "-78.0", "-49.0", "-85.0", "39.0", "-12.0", "-50.0", "65.0", "-69.0", "45.0", "-98.0", "-69.0", "-41.0", "60.0", "72.0", "90.0", "60.0", "-76.0", "71.0", "51.0", "69.0", "55.0", "-69.0", "68.0", "69.0", "-58.0", "-48.0", "-76.0", "97.0", "-38.0", "16.0", "-20.0", "-69.0", "-57.0", "-98.0", "-69.0", "0.0", "0.0", "0.0", "-12.0", "-69.0", "-74.0", "-39.0", "-67.0", "-63.0", "-69.0", "74.0", "80.0", "90.0", "45.0", "69.0", "69.0", "-77.0", "-60.0", "-69.0", "-44.0", "-72.0", "-59.0", "-69.0", "Lon", "0.0", "-73.0", "38.0", "61.0", "-75.0", "-69.0", "34.0", "49.0", "69.0", "55.0", "69.0", "85.0", "69.0", "71.0", "81.0", "64.0", "58.0", "-78.0", "69.0", "36.0", "69.0", "76.0", "-77.0", "-59.0", "-55.0", "-74.0", "0.0", "-99.0", "69.0", "69.0", "55.0", "56.0", "-17.0", "58.0", "30.0", "-46.0", "-97.0", "21.0", "68.0", "-36.0", "-49.0", "-19.0", "-56.0", "17.0", "69.0", "51.0", "70.0", "33.0", "93.0", "69.0", "63.0", "58.0", "42.0", "79.0", "0.0", "20.0", "47.0", "66.0", "75.0", "42.0", "69.0", "67.0", "69.0", "-85.0", "39.0", "69.0", "47.0", "36.0", "-10.0", "42.0", "69.0", "40.0", "74.0", "69.0", "-20.0", "-20.0", "-97.0", "-4.0", "72.0", "63.0", "-97.0", "39.0", "61.0", "69.0", "-60.0", "-95.0", "-69.0", "-84.0", "-20.0", "79.0", "45.0", "0.0", "-52.0", "-69.0", "-94.0", "66.0", "0.0", "89.0", "-49.0", "-69.0", "72.0", "92.0", "96.0", "87.0", "77.0", "68.0", "69.0", "91.0", "99.0", "49.0", "33.0", "66.0", "72.0", "76.0", "95.0", "69.0", "63.0", "59.0", "60.0", "69.0", "58.0", "64.0", "-66.0", "-71.0", "80.0", "46.0", "66.0", "96.0", "-67.0", "34.0", "41.0", "69.0", "-39.0", "-76.0", "60.0", "42.0", "93.0", "-77.0", "75.0", "83.0", "74.0", "39.0", "69.0", "-37.0", "-69.0", "-38.0", "-72.0", "91.0", "30.0", "-73.0", "0.0", "-20.0", "-14.0", "98.0", "20.0", "95.0", "-73.0", "-21.0", "-59.0", "-69.0", "-86.0", "-36.0", "-96.0", "-79.0", "-69.0", "-28.0", "69.0", "76.0", "0.0", "40.0", "-58.0", "-72.0", "-46.0", "20.0", "-41.0", "-77.0", "-78.0", "-78.0", "-49.0", "-85.0", "39.0", "-12.0", "-50.0", "65.0", "-69.0", "45.0", "-98.0", "-69.0", "-41.0", "60.0", "72.0", "90.0", "60.0", "-76.0", "71.0", "51.0", "69.0", "55.0", "-69.0", "68.0", "69.0", "-58.0", "-48.0", "-76.0", "97.0", "-38.0", "16.0", "-20.0", "-69.0", "-57.0", "-98.0", "-69.0", "0.0", "0.0", "0.0", "-12.0", "-69.0", "-74.0", "-39.0", "-67.0", "-63.0", "-69.0", "74.0", "80.0", "90.0", "45.0", "69.0", "69.0", "-77.0", "-60.0", "-69.0", "-44.0", "-72.0", "-59.0", "-69.0" ], "marker": { "color": "rgb(255, 0, 0)", "opacity": 0.7, "size": 17 }, "mode": "markers", "name": "All Events", "text": [ "Faceoff", "Giveaway", "Hit", "Giveaway", "Shot", "Faceoff", "Shot", "Shot", "Faceoff", "Shot", "Faceoff", "Penalty", "Faceoff", "Hit", "Missed Shot", "Giveaway", "Blocked Shot", "Shot", "Faceoff", "Shot", "Faceoff", "Giveaway", "Blocked Shot", "Blocked Shot", "Shot", "Goal", "Faceoff", "Hit", "Faceoff", "Faceoff", "Blocked Shot", "Missed Shot", "Takeaway", "Blocked Shot", "Giveaway", "Blocked Shot", "Hit", "Hit", "Missed Shot", "Shot", "Missed Shot", "Hit", "Hit", "Penalty", "Faceoff", "Missed Shot", "Giveaway", "Shot", "Hit", "Faceoff", "Blocked Shot", "Blocked Shot", "Shot", "Goal", "Faceoff", "Faceoff", "Hit", "Blocked Shot", "Shot", "Shot", "Faceoff", "Missed Shot", "Faceoff", "Hit", "Shot", "Faceoff", "Missed Shot", "Hit", "Giveaway", "Shot", "Faceoff", "Missed Shot", "Shot", "Faceoff", "Faceoff", "Faceoff", "Hit", "Hit", "Missed Shot", "Blocked Shot", "Hit", "Hit", "Shot", "Faceoff", "Missed Shot", "Hit", "Faceoff", "Giveaway", "Faceoff", "Hit", "Missed Shot", "Faceoff", "Shot", "Faceoff", "Hit", "Blocked Shot", "Faceoff", "Hit", "Missed Shot", "Faceoff", "Blocked Shot", "Hit", "Hit", "Hit", "Missed Shot", "Penalty", "Faceoff", "Hit", "Hit", "Shot", "Missed Shot", "Blocked Shot", "Missed Shot", "Shot", "Penalty", "Faceoff", "Blocked Shot", "Shot", "Blocked Shot", "Faceoff", "Blocked Shot", "Missed Shot", "Giveaway", "Blocked Shot", "Hit", "Missed Shot", "Blocked Shot", "Hit", "Blocked Shot", "Takeaway", "Shot", "Faceoff", "Blocked Shot", "Shot", "Giveaway", "Hit", "Hit", "Shot", "Missed Shot", "Hit", "Blocked Shot", "Shot", "Faceoff", "Shot", "Faceoff", "Missed Shot", "Blocked Shot", "Hit", "Hit", "Goal", "Faceoff", "Faceoff", "Shot", "Hit", "Faceoff", "Hit", "Blocked Shot", "Hit", "Shot", "Faceoff", "Hit", "Missed Shot", "Hit", "Penalty", "Faceoff", "Penalty", "Faceoff", "Shot", "Faceoff", "Missed Shot", "Shot", "Blocked Shot", "Missed Shot", "Faceoff", "Hit", "Hit", "Shot", "Giveaway", "Missed Shot", "Hit", "Missed Shot", "Takeaway", "Missed Shot", "Giveaway", "Faceoff", "Shot", "Hit", "Faceoff", "Shot", "Shot", "Shot", "Giveaway", "Shot", "Blocked Shot", "Shot", "Penalty", "Faceoff", "Hit", "Faceoff", "Missed Shot", "Blocked Shot", "Missed Shot", "Missed Shot", "Shot", "Hit", "Shot", "Hit", "Faceoff", "Faceoff", "Missed Shot", "Hit", "Faceoff", "Faceoff", "Faceoff", "Faceoff", "Penalty", "Faceoff", "Shot", "Shot", "Blocked Shot", "Blocked Shot", "Faceoff", "Shot", "Missed Shot", "Hit", "Shot", "Faceoff", "Faceoff", "Blocked Shot", "Blocked Shot", "Faceoff", "Missed Shot", "Blocked Shot", "Takeaway", "Faceoff", "Event", "Faceoff", "Giveaway", "Hit", "Giveaway", "Shot", "Faceoff", "Shot", "Shot", "Faceoff", "Shot", "Faceoff", "Penalty", "Faceoff", "Hit", "Missed Shot", "Giveaway", "Blocked Shot", "Shot", "Faceoff", "Shot", "Faceoff", "Giveaway", "Blocked Shot", "Blocked Shot", "Shot", "Goal", "Faceoff", "Hit", "Faceoff", "Faceoff", "Blocked Shot", "Missed Shot", "Takeaway", "Blocked Shot", "Giveaway", "Blocked Shot", "Hit", "Hit", "Missed Shot", "Shot", "Missed Shot", "Hit", "Hit", "Penalty", "Faceoff", "Missed Shot", "Giveaway", "Shot", "Hit", "Faceoff", "Blocked Shot", "Blocked Shot", "Shot", "Goal", "Faceoff", "Faceoff", "Hit", "Blocked Shot", "Shot", "Shot", "Faceoff", "Missed Shot", "Faceoff", "Hit", "Shot", "Faceoff", "Missed Shot", "Hit", "Giveaway", "Shot", "Faceoff", "Missed Shot", "Shot", "Faceoff", "Faceoff", "Faceoff", "Hit", "Hit", "Missed Shot", "Blocked Shot", "Hit", "Hit", "Shot", "Faceoff", "Missed Shot", "Hit", "Faceoff", "Giveaway", "Faceoff", "Hit", "Missed Shot", "Faceoff", "Shot", "Faceoff", "Hit", "Blocked Shot", "Faceoff", "Hit", "Missed Shot", "Faceoff", "Blocked Shot", "Hit", "Hit", "Hit", "Missed Shot", "Penalty", "Faceoff", "Hit", "Hit", "Shot", "Missed Shot", "Blocked Shot", "Missed Shot", "Shot", "Penalty", "Faceoff", "Blocked Shot", "Shot", "Blocked Shot", "Faceoff", "Blocked Shot", "Missed Shot", "Giveaway", "Blocked Shot", "Hit", "Missed Shot", "Blocked Shot", "Hit", "Blocked Shot", "Takeaway", "Shot", "Faceoff", "Blocked Shot", "Shot", "Giveaway", "Hit", "Hit", "Shot", "Missed Shot", "Hit", "Blocked Shot", "Shot", "Faceoff", "Shot", "Faceoff", "Missed Shot", "Blocked Shot", "Hit", "Hit", "Goal", "Faceoff", "Faceoff", "Shot", "Hit", "Faceoff", "Hit", "Blocked Shot", "Hit", "Shot", "Faceoff", "Hit", "Missed Shot", "Hit", "Penalty", "Faceoff", "Penalty", "Faceoff", "Shot", "Faceoff", "Missed Shot", "Shot", "Blocked Shot", "Missed Shot", "Faceoff", "Hit", "Hit", "Shot", "Giveaway", "Missed Shot", "Hit", "Missed Shot", "Takeaway", "Missed Shot", "Giveaway", "Faceoff", "Shot", "Hit", "Faceoff", "Shot", "Shot", "Shot", "Giveaway", "Shot", "Blocked Shot", "Shot", "Penalty", "Faceoff", "Hit", "Faceoff", "Missed Shot", "Blocked Shot", "Missed Shot", "Missed Shot", "Shot", "Hit", "Shot", "Hit", "Faceoff", "Faceoff", "Missed Shot", "Hit", "Faceoff", "Faceoff", "Faceoff", "Faceoff", "Penalty", "Faceoff", "Shot", "Shot", "Blocked Shot", "Blocked Shot", "Faceoff", "Shot", "Missed Shot", "Hit", "Shot", "Faceoff", "Faceoff", "Blocked Shot", "Blocked Shot", "Faceoff", "Missed Shot", "Blocked Shot", "Takeaway", "Faceoff" ], "type": "scattermapbox" }, { "hoverinfo": "text", "lat": [ "38.0", "40.0", "-13.0", "-14.0", "39.0", "-41.0", "-40.0", "-28.0", "40.0", "34.0", "-37.0", "8.0", "-42.0", "-13.0", "39.0", "19.0", "-37.0", "-25.0", "31.0", "31.0", "4.0", "-32.0", "28.0", "11.0", "-38.0", "22.0", "-38.0", "-27.0", "-36.0", "-33.0", "-23.0", "7.0", "-17.0", "-40.0", "-32.0", "21.0", "-38.0", "-39.0", "-33.0", "16.0", "-38.0", "-9.0", "-40.0", "-6.0", "-33.0", "38.0", "40.0", "-13.0", "-14.0", "39.0", "-41.0", "-40.0", "-28.0", "40.0", "34.0", "-37.0", "8.0", "-42.0", "-13.0", "39.0", "19.0", "-37.0", "-25.0", "31.0", "31.0", "4.0", "-32.0", "28.0", "11.0", "-38.0", "22.0", "-38.0", "-27.0", "-36.0", "-33.0", "-23.0", "7.0", "-17.0", "-40.0", "-32.0", "21.0", "-38.0", "-39.0", "-33.0", "16.0", "-38.0", "-9.0", "-40.0", "-6.0", "-33.0" ], "lon": [ "38.0", "71.0", "-99.0", "-97.0", "21.0", "-19.0", "-56.0", "93.0", "47.0", "-85.0", "36.0", "-97.0", "-4.0", "-97.0", "39.0", "-95.0", "79.0", "-94.0", "89.0", "92.0", "96.0", "87.0", "91.0", "99.0", "80.0", "96.0", "42.0", "93.0", "83.0", "91.0", "30.0", "98.0", "95.0", "-21.0", "-86.0", "-96.0", "-41.0", "-77.0", "-85.0", "-98.0", "55.0", "97.0", "16.0", "-98.0", "90.0", "38.0", "71.0", "-99.0", "-97.0", "21.0", "-19.0", "-56.0", "93.0", "47.0", "-85.0", "36.0", "-97.0", "-4.0", "-97.0", "39.0", "-95.0", "79.0", "-94.0", "89.0", "92.0", "96.0", "87.0", "91.0", "99.0", "80.0", "96.0", "42.0", "93.0", "83.0", "91.0", "30.0", "98.0", "95.0", "-21.0", "-86.0", "-96.0", "-41.0", "-77.0", "-85.0", "-98.0", "55.0", "97.0", "16.0", "-98.0", "90.0" ], "marker": { "color": "rgb(255,255,0)", "opacity": 0.7, "size": 10 }, "mode": "markers", "name": "Hits", "text": [ "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit", "Hit" ], "type": "scattermapbox" }, { "hoverinfo": "text", "lat": [ "15.0", "21.0", "0.0", "-31.0", "20.0", "-16.0", "21.0", "-7.0", "9.0", "12.0", "1.0", "-16.0", "-28.0", "-16.0", "5.0", "-12.0", "9.0", "6.0", "-29.0", "3.0", "-12.0", "-7.0", "11.0", "7.0", "-1.0", "-25.0", "-19.0", "-12.0", "-20.0", "-14.0", "5.0", "5.0", "-10.0", "-6.0", "9.0", "27.0", "-29.0", "15.0", "-15.0", "21.0", "3.0", "-11.0", "-22.0", "-6.0", "-8.0", "-4.0", "-23.0", "4.0", "11.0", "-1.0", "-17.0", "-13.0", "1.0", "-20.0", "-5.0", "0.0", "-22.0", "2.0", "12.0", "-18.0", "-33.0", "0.0", "17.0", "-29.0", "13.0", "-6.0", "13.0", "-10.0", "-28.0", "2.0", "-3.0", "-1.0", "-28.0", "6.0", "-30.0", "7.0", "27.0", "20.0", "-5.0", "23.0", "-16.0", "7.0", "-16.0", "5.0", "9.0", "0.0", "-2.0", "-11.0", "-21.0", "-2.0", "-4.0", "3.0", "-6.0", "-13.0", "-22.0", "5.0", "18.0", "-1.0", "-9.0", "0.0", "5.0", "-1.0", "20.0", "-3.0", "15.0", "21.0", "0.0", "-31.0", "20.0", "-16.0", "21.0", "-7.0", "9.0", "12.0", "1.0", "-16.0", "-28.0", "-16.0", "5.0", "-12.0", "9.0", "6.0", "-29.0", "3.0", "-12.0", "-7.0", "11.0", "7.0", "-1.0", "-25.0", "-19.0", "-12.0", "-20.0", "-14.0", "5.0", "5.0", "-10.0", "-6.0", "9.0", "27.0", "-29.0", "15.0", "-15.0", "21.0", "3.0", "-11.0", "-22.0", "-6.0", "-8.0", "-4.0", "-23.0", "4.0", "11.0", "-1.0", "-17.0", "-13.0", "1.0", "-20.0", "-5.0", "0.0", "-22.0", "2.0", "12.0", "-18.0", "-33.0", "0.0", "17.0", "-29.0", "13.0", "-6.0", "13.0", "-10.0", "-28.0", "2.0", "-3.0", "-1.0", "-28.0", "6.0", "-30.0", "7.0", "27.0", "20.0", "-5.0", "23.0", "-16.0", "7.0", "-16.0", "5.0", "9.0", "0.0", "-2.0", "-11.0", "-21.0", "-2.0", "-4.0", "3.0", "-6.0", "-13.0", "-22.0", "5.0", "18.0", "-1.0", "-9.0", "0.0", "5.0", "-1.0", "20.0", "-3.0" ], "lon": [ "-75.0", "34.0", "49.0", "55.0", "81.0", "58.0", "-78.0", "36.0", "-77.0", "-59.0", "-55.0", "55.0", "56.0", "58.0", "-46.0", "68.0", "-36.0", "-49.0", "51.0", "33.0", "63.0", "58.0", "42.0", "66.0", "75.0", "42.0", "67.0", "39.0", "47.0", "42.0", "40.0", "74.0", "72.0", "63.0", "61.0", "-60.0", "45.0", "-52.0", "66.0", "-49.0", "72.0", "77.0", "49.0", "33.0", "66.0", "72.0", "76.0", "63.0", "59.0", "60.0", "58.0", "64.0", "-71.0", "46.0", "66.0", "-67.0", "41.0", "-39.0", "-76.0", "-77.0", "75.0", "74.0", "39.0", "-37.0", "-38.0", "-72.0", "-14.0", "-73.0", "-59.0", "-36.0", "76.0", "40.0", "-58.0", "-72.0", "-46.0", "-78.0", "-49.0", "39.0", "-50.0", "45.0", "-41.0", "60.0", "72.0", "60.0", "-76.0", "71.0", "68.0", "69.0", "-58.0", "-48.0", "-76.0", "-38.0", "-57.0", "-74.0", "-39.0", "-67.0", "-63.0", "74.0", "80.0", "45.0", "-77.0", "-60.0", "-44.0", "-72.0", "-75.0", "34.0", "49.0", "55.0", "81.0", "58.0", "-78.0", "36.0", "-77.0", "-59.0", "-55.0", "55.0", "56.0", "58.0", "-46.0", "68.0", "-36.0", "-49.0", "51.0", "33.0", "63.0", "58.0", "42.0", "66.0", "75.0", "42.0", "67.0", "39.0", "47.0", "42.0", "40.0", "74.0", "72.0", "63.0", "61.0", "-60.0", "45.0", "-52.0", "66.0", "-49.0", "72.0", "77.0", "49.0", "33.0", "66.0", "72.0", "76.0", "63.0", "59.0", "60.0", "58.0", "64.0", "-71.0", "46.0", "66.0", "-67.0", "41.0", "-39.0", "-76.0", "-77.0", "75.0", "74.0", "39.0", "-37.0", "-38.0", "-72.0", "-14.0", "-73.0", "-59.0", "-36.0", "76.0", "40.0", "-58.0", "-72.0", "-46.0", "-78.0", "-49.0", "39.0", "-50.0", "45.0", "-41.0", "60.0", "72.0", "60.0", "-76.0", "71.0", "68.0", "69.0", "-58.0", "-48.0", "-76.0", "-38.0", "-57.0", "-74.0", "-39.0", "-67.0", "-63.0", "74.0", "80.0", "45.0", "-77.0", "-60.0", "-44.0", "-72.0" ], "marker": { "color": "rgb(0, 0, 255)", "opacity": 0.7, "size": 10 }, "mode": "markers", "name": "Shots", "text": [ "Shot", "Shot", "Shot", "Shot", "Missed Shot", "Blocked Shot", "Shot", "Shot", "Blocked Shot", "Blocked Shot", "Shot", "Blocked Shot", "Missed Shot", "Blocked Shot", "Blocked Shot", "Missed Shot", "Shot", "Missed Shot", "Missed Shot", "Shot", "Blocked Shot", "Blocked Shot", "Shot", "Blocked Shot", "Shot", "Shot", "Missed Shot", "Shot", "Missed Shot", "Shot", "Missed Shot", "Shot", "Missed Shot", "Blocked Shot", "Shot", "Missed Shot", "Missed Shot", "Shot", "Blocked Shot", "Missed Shot", "Blocked Shot", "Missed Shot", "Shot", "Missed Shot", "Blocked Shot", "Missed Shot", "Shot", "Blocked Shot", "Shot", "Blocked Shot", "Blocked Shot", "Missed Shot", "Blocked Shot", "Missed Shot", "Blocked Shot", "Blocked Shot", "Shot", "Blocked Shot", "Shot", "Shot", "Missed Shot", "Blocked Shot", "Shot", "Shot", "Missed Shot", "Blocked Shot", "Shot", "Blocked Shot", "Shot", "Missed Shot", "Shot", "Missed Shot", "Shot", "Blocked Shot", "Missed Shot", "Shot", "Missed Shot", "Missed Shot", "Missed Shot", "Shot", "Shot", "Shot", "Shot", "Shot", "Blocked Shot", "Shot", "Missed Shot", "Blocked Shot", "Missed Shot", "Missed Shot", "Shot", "Shot", "Missed Shot", "Shot", "Shot", "Blocked Shot", "Blocked Shot", "Shot", "Missed Shot", "Shot", "Blocked Shot", "Blocked Shot", "Missed Shot", "Blocked Shot", "Shot", "Shot", "Shot", "Shot", "Missed Shot", "Blocked Shot", "Shot", "Shot", "Blocked Shot", "Blocked Shot", "Shot", "Blocked Shot", "Missed Shot", "Blocked Shot", "Blocked Shot", "Missed Shot", "Shot", "Missed Shot", "Missed Shot", "Shot", "Blocked Shot", "Blocked Shot", "Shot", "Blocked Shot", "Shot", "Shot", "Missed Shot", "Shot", "Missed Shot", "Shot", "Missed Shot", "Shot", "Missed Shot", "Blocked Shot", "Shot", "Missed Shot", "Missed Shot", "Shot", "Blocked Shot", "Missed Shot", "Blocked Shot", "Missed Shot", "Shot", "Missed Shot", "Blocked Shot", "Missed Shot", "Shot", "Blocked Shot", "Shot", "Blocked Shot", "Blocked Shot", "Missed Shot", "Blocked Shot", "Missed Shot", "Blocked Shot", "Blocked Shot", "Shot", "Blocked Shot", "Shot", "Shot", "Missed Shot", "Blocked Shot", "Shot", "Shot", "Missed Shot", "Blocked Shot", "Shot", "Blocked Shot", "Shot", "Missed Shot", "Shot", "Missed Shot", "Shot", "Blocked Shot", "Missed Shot", "Shot", "Missed Shot", "Missed Shot", "Missed Shot", "Shot", "Shot", "Shot", "Shot", "Shot", "Blocked Shot", "Shot", "Missed Shot", "Blocked Shot", "Missed Shot", "Missed Shot", "Shot", "Shot", "Missed Shot", "Shot", "Shot", "Blocked Shot", "Blocked Shot", "Shot", "Missed Shot", "Shot", "Blocked Shot", "Blocked Shot", "Missed Shot", "Blocked Shot" ], "type": "scattermapbox" } ], "layout": { "autosize": true, "hovermode": "closest", "legend": { "bgcolor": "LightSteelBlue", "bordercolor": "Black", "borderwidth": 4, "font": { "color": "black", "family": "sans-serif", "size": 12 }, "orientation": "h", "title": { "text": " Layers " }, "traceorder": "normal", "x": 0.1, "y": 1.2 }, "mapbox": { "accesstoken": "pk.eyJ1IjoiaXNhYWN2IiwiYSI6ImNrMnpqYnVxaTA1b3IzbXBnaG5zY3o3eTEifQ.kMdIcXYBFKHTorj3Hxgi7g", "bearing": 0, "center": { "lat": 0, "lon": 0 }, "pitch": 0, "style": "mapbox://styles/isaacv/ck7aposk400za1ip6rwingtiz", "zoom": 1 }, "showlegend": true, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Events" } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import plotly.graph_objects as go\n", "import pandas as pd\n", "import plotly.express as px\n", "mapbox_access_token = open(\"mapbox_token.txt\").read() # Create a local file with mapbox token\n", "\n", "\n", "df = pd.read_csv('events.csv')\n", "events_lat = df.Lat\n", "events_lon = df.Lon\n", "locations_name = df.Event\n", "\n", "hits = df[df['Event'].str.contains('Hit')]\n", "hits_lat = df[df['Event'].str.contains('Hit')]['Lat']\n", "hits_lon = df[df['Event'].str.contains('Hit')]['Lon']\n", "hits_text = df[df['Event'].str.contains('Hit')]['Event']\n", "\n", "shots = df[df['Event'].str.contains('Shot')]\n", "shots_lat = df[df['Event'].str.contains('Shot')]['Lat']\n", "shots_lon = df[df['Event'].str.contains('Shot')]['Lon']\n", "shots_text = df[df['Event'].str.contains('Shot')]['Event']\n", "\n", "fig = go.Figure()\n", "\n", "fig.add_trace(go.Scattermapbox(\n", " lat=events_lat,\n", " lon=events_lon,\n", " mode='markers',\n", " marker=go.scattermapbox.Marker(\n", " size=17,\n", " color='rgb(255, 0, 0)',\n", " opacity=0.7\n", " ),\n", " text=locations_name,\n", " hoverinfo='text',\n", " name=\"All Events\"\n", " ))\n", "\n", "fig.add_trace(go.Scattermapbox(\n", " lat=hits_lat,\n", " lon=hits_lon,\n", " mode='markers',\n", " marker=go.scattermapbox.Marker(\n", " size=10,\n", " color='rgb(255,255,0)',\n", " opacity=0.7\n", " ),\n", " text=hits_text,\n", " hoverinfo='text',\n", " name=\"Hits\"\n", " ))\n", "\n", "fig.add_trace(go.Scattermapbox(\n", " lat=shots_lat,\n", " lon=shots_lon,\n", " mode='markers',\n", " marker=go.scattermapbox.Marker(\n", " size=10,\n", " color='rgb(0, 0, 255)',\n", " opacity=0.7\n", " ),\n", " text=shots_text,\n", " hoverinfo='text',\n", " name=\"Shots\"\n", " ))\n", "\n", "fig.update_layout(\n", " title='Events',\n", " autosize=True,\n", " hovermode='closest',\n", " showlegend=True,\n", " legend_title=' Layers ',\n", " legend_orientation=\"h\",\n", " legend=dict(\n", " x=.1,\n", " y=1.2,\n", " traceorder=\"normal\",\n", " font=dict(\n", " family=\"sans-serif\",\n", " size=12,\n", " color=\"black\"\n", " ),\n", " bgcolor=\"LightSteelBlue\",\n", " bordercolor=\"Black\",\n", " borderwidth=4\n", " ),\n", " mapbox=dict(\n", " accesstoken=mapbox_access_token,\n", " bearing=0,\n", " center=dict(\n", " lat=0,\n", " lon=0\n", " ),\n", " pitch=0,\n", " zoom=1,\n", " style='mapbox://styles/isaacv/ck7aposk400za1ip6rwingtiz'\n", " ),\n", ")\n", "\n", "fig.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "There are a number of things I can do from here:\n", " \n", " -Can style each point based on their type of event\n", " -Can display a media item based on the event\n", " -Can group together the types of events and show them relative to time\n", " \n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.6.10" } }, "nbformat": 4, "nbformat_minor": 4 }