Geoview Labels grouped with points

Good morning. First post here, apologies if this has been solved elsewhere, my search came up empty.

As the title implies, I have grouped lat/lot points, selectable by drop down. I can see the values with a hover tool but would like the labels of the selected point group to be visible on the native plot. So far all of my attempts have failed, backend can’t support the format error.

I haven’t tried to plot labels in geoviews before, so maybe something basic I am missing. Looking for any advice on how to troubleshoot before I post code snippets. Thanks!


Hello John!

Here’s a basic geoviews example we can tinker with to try and get you troubleshooting:

import holoviews as hv
import geoviews as gv
import geoviews.tile_sources as gts
import pandas as pd
import geopandas
import panel as pn


df = pd.DataFrame(
                    {'City': ['Buenos Aires', 'Brasilia', 'Santiago', 'Bogota', 'Caracas','Tacna','Pucallpa','Lima','Langa'],
                    'Country': ['Argentina', 'Brazil', 'Chile', 'Colombia', 'Venezuela','Peru','Peru','Peru','Peru'],
                    'Latitude': [-34.58, -15.78, -33.45, 4.60, 10.48, -18.006,-8.392,-12.046,-12.125],
                    'Longitude': [-58.66, -47.91, -70.66, -74.08, -66.86,-70.246,-74.582,-77.0427,-76.4211]})       
gdf = geopandas.GeoDataFrame(df, geometry=geopandas.points_from_xy(df.Longitude, df.Latitude),crs="EPSG:3857")

gv_table = hv.Table(gdf)
checkbutton_group = pn.widgets.CheckButtonGroup(name='Check Button Group', value=['Points'], options=['Labels', 'Points'])

def full_plot(vis_list):
    base_plot = [tiles,]
    points = gv.Points(gv_table,kdims=['Longitude','Latitude'],vdims=['City','Country'])
    labels = gv.Labels(points,vdims=['City'])
    if 'Points' in vis_list:
    if 'Labels' in vis_list:
    return hv.Overlay(base_plot)

plot = hv.DynamicMap(full_plot)

layout = pn.Row(pn.Column(checkbutton_group,plot.opts(width=600,height=600)))

This should let you toggle on/off the point labels via the widget at the top:

… is this close to what you were aiming for? Instead of the widget you could trigger the label visibility of other things too, like selection streams, etc…

Thank you! I tried this in VS Code as a jupyter notebook, I can get the labels to show if I disable the conditional. For some reason, selecting Labels doesn’t feed back as I expect. Maybe an environment issue? Other geoviews groupby selections tend to work OK.

Really appreciate your assistance here. This is definite progress.


Just a brief update on this. The example provided has been very helpful on a few fronts. It has helped me understand the functionality, but also revealed that part of my confusion stemmed from dysfunction in VS Code’s handling of jupyter notebook/holoviews interaction.

The provided example works fine in standalone Jupyter Notebook, but is inert in VS Code. I thought the answer was to update VS Code, but that was a mistake, as I have lost even more functionality. Geoview group by displays with a lateral drop down or radio button side bar no longer work as intended.

At the risk of inducing drift in my own thread, could someone point me toward a discussion of VS Code configuration to support Holoviews/geoviews?



Hello John,

What I usually do is split my workflow into 2 parts:

  1. panel/holoviews/geoviews toy examples / prototyping in Jupyter to get a basic UI and/or interaction proved out
  2. then copy/paste the useful bits into a class in a wider code-base using VS code; typically a FastAPI/tornado webserver (you can launch it locally). At that point iterations are more of a server reload and refresh browser pattern.

See FastAPI + Panel CookieCutter template for a demo template you could use.