Why does hv.Points and hvplot do not display Points for a DataFrame?

Hello everyone,

I’m facing an issue with holoviews (also in geoviews) and hvplot when attempting to visualize points from a (Geo)DataFrame. When I’m using hv.Path I can plot the geometries as expected, but when I use hv.Points this does not work.

Please see the reproducible example below:

import geopandas as gpd
import geoviews as gv
import holoviews as hv
import hvplot.pandas
import numpy as np
import pandas as pd
from shapely.geometry import LineString


def generate_sample_data(n_rows=5):
    # Using linspace to define start and end points
    start_lons = np.linspace(-8.63759, -8.63829, n_rows)
    end_lons = start_lons + 0.02351

    start_lats = np.linspace(40.97795, 40.97439, n_rows)
    end_lats = start_lats + 0.00267

    geometries = [
        LineString([(slon, slat), (elon, elat)])
        for slon, slat, elon, elat in zip(start_lons, start_lats, end_lons, end_lats)
    lons = (start_lons + end_lons) / 2
    lats = (start_lats + end_lats) / 2

    df = gpd.GeoDataFrame({"geometry": geometries, "lon": lons, "lat": lats}, crs=4326)

    return df

# Test the function
gdf = generate_sample_data()
hv.Path(gdf[["geometry"]])  # works as expected
gv.Path(gdf[["geometry"]])  # works as expected
gdf[["geometry"]].hvplot()  # works as expected

points_gdf = gpd.GeoDataFrame(
    geometry=gpd.GeoSeries.from_xy(gdf.lon, gdf.lat), crs=4326
gv.Points(points_gdf[["geometry"]])  # empty plot
hv.Points(points_gdf[["geometry"]])  # empty plot
points_gdf[["geometry"]].hvplot()  # empty plot

Probably I’m missing something obvious, or is this a bug?

Ok, I found the issue. I’m managing my jupyter environment as a seperate env and connect to my dev environments in Jupyterlab using nb_conda_kernels. Before that worked without having bokeh and holoviews installed in the base jupyterlab environment, but probably with the upgrade to jupyterlab 4 or a newer version of holoviews something changed. So I simply had to install holoviews and bokeh in my base jupyterlab environment and now things work as expected.

I have this issue too and found a github issue describing it too: hvplot.points generates error when color is mapped to a variable and dataframe contains NaN values for axis variables · Issue #1202 · holoviz/hvplot · GitHub