Combining plot with pane.Holoviews

Dear All,

kindly please advise how to combine plot with pane holoviews from each plot.my code:

import geopandas as gpd
import pandas as pd
import hvplot.pandas
import panel as pn
from shapely.geometry import Point
#import shapely

# Create a GeoDataFrame with a Point geometry column
#data = {'geometry': [Point(-74.005974, 40.712776), Point(-73.986259, 40.748817)]}
gdf = gpd.read_file('https://github.com/opengeos/leafmap/raw/master/examples/data/cable_geo.geojson')

# Extract latitude and longitude into new columns
#gdf['latitude'] = gdf.geometry.y
#gdf['longitude'] = gdf.geometry.x

# Sample DataFrames (replace these with your actual data)
df1_data = {'Latitude': [-100.712776, 40.748817], 'Longitude': [100.005974, -73.986259], 'value1': [10, 20]}
df1 = pd.DataFrame(df1_data)

df2_data = {'latitude': [-40.712776, 40.748817], 'longitude': [74.005974, -73.986259], 'value2': [30, 40]}
df2 = pd.DataFrame(df2_data)

# Display the GeoDataFrame
a=pn.pane.HoloViews(gdf.hvplot(geo=True, line_color='blue', line_width=1,  frame_width=400, frame_height=400))
b=pn.pane.HoloViews(df1.hvplot(geo=True,x='Longitude',y='Latitude',kind='points', color='red', frame_width=400, frame_height=400))
b*a

run above code give:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[19], line 26
     24 a=pn.pane.HoloViews(gdf.hvplot(geo=True, line_color='blue', line_width=1,  frame_width=400, frame_height=400))
     25 b=pn.pane.HoloViews(df1.hvplot(geo=True,x='Longitude',y='Latitude',kind='points', color='red', frame_width=400, frame_height=400))
---> 26 b*a

TypeError: unsupported operand type(s) for *: 'HoloViews' and 'HoloViews'

kindly please advice

a=gdf.hvplot(geo=True, line_color='blue', line_width=1,  frame_width=400, frame_height=400)
b=df1.hvplot(geo=True,x='Longitude',y='Latitude',kind='points', color='red', frame_width=400, frame_height=400)
pn.pane.HoloViews(b*a)
1 Like

thanks @Hoxbro for the advice. Perfect

regards

1 Like