Custom hover info of gv.Points

Hi! I’m trying to code similar map to this one GeoViews Gallery - world population and I have two questions. It would be nice to see your tips or solutions:

  1. How to hide Latitude and Longitude in hover window of each point?

  2. Is there any method to customize the hover window (e.g. colors, fonts)?

The code of the example map:

import pandas as pd
import geoviews as gv
from geoviews import dim

gv.extension('bokeh')


cities = pd.read_csv('../../assets/cities.csv', encoding="ISO-8859-1")
population = gv.Dataset(cities, kdims=['City', 'Country', 'Year'])
points = population.to(gv.Points, ['Longitude', 'Latitude'], ['Population', 'City', 'Country'])

tiles = gv.tile_sources.Wikipedia

tiles * points.opts(
    color='Population', cmap='viridis', size=dim('Population')*0.000001,
    tools=['hover'], global_extent=True, width=600, height=600)
3 Likes

See Configuring plot tools — Bokeh 2.4.2 Documentation, then once you have a bokeh hover_tool = HoverTool(...) object instantiated, pass in with
tools=[hover_tool]

3 Likes

Thanks a lot! It works good.