{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "URL: https://docs.bokeh.org/en/latest/docs/examples/topics/geo/texas_hover_map.html\n", "\n", "Most examples work across multiple plotting backends, this example is also available for:\n", "\n", "* [Bokeh - texas choropleth example](../bokeh/texas_choropleth_example.ipynb)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import holoviews as hv\n", "hv.extension('matplotlib')\n", "hv.output(fig='svg')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Declaring data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from bokeh.sampledata.us_counties import data as counties\n", "from bokeh.sampledata.unemployment import data as unemployment\n", "\n", "\n", "counties = [dict(county, Unemployment=unemployment[cid])\n", " for cid, county in counties.items()\n", " if county[\"state\"] == \"tx\"]\n", "\n", "\n", "detailed_name = 'detailed_name' if counties[0].get('detailed_name') else 'detailed name' # detailed name was changed in Bokeh 3.0\n", "choropleth = hv.Polygons(counties, ['lons', 'lats'], [(detailed_name, 'County'), 'Unemployment'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "choropleth.opts(\n", " color='Unemployment', edgecolor='white',\n", " xaxis=None, yaxis=None, show_grid=False,\n", " show_frame=False, colorbar=True, fig_size=200)" ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 4 }