xarray holoviews (hvplot.xarray) issue in Spyder

182 Views Asked by At

I have some .nc data that I use xarray to analyze. I wanted to overlay a shapefile on the plot and came across hv.plot which seems to have the interactive component I have been needing. However, when I tried to plot, it does not seem to work. Then I found the following thread: Why doesn't holoviews show histogram in Spyder? but could not get Maxime's answer to work and Sander's only partly works, however I have trouble "connecting to the local host" consistently. Does anyone have a solution?

ds_path = 'Z:/MODIS-LAADS-DAAC/'
ds_file = 'anom_2016_v1.nc'

ds_anom = xr.open_dataset(ds_path+ds_file) 
x = ds_anom.Rrs_667.isel(time=0)

# create holoviews plot
hv_map = x.hvplot() 

# display graph in browser
# a bokeh server is automatically started
bokeh_server = pn.Row(hv_map).show(port=12345)

# stop the bokeh server (when needed)
bokeh_server.stop() 

However, I get this 95% of the time ERR_CONNECTION_REFUSED but occasionally get it to work and look like this (however I don't know why!!!) sample ocean data plot

IN SUMMARY:

What I want to do: https://tutorial.xarray.dev/scipy-tutorial/04_plotting_and_visualization.html#interactive-bokeh-plots-using-hvplot , https://hvplot.holoviz.org/user_guide/Geographic_Data.html#declaring-an-output-projection

What I have tried: https://discourse.holoviz.org/t/whats-the-most-efficient-way-to-overlay-a-shapefile-onto-a-hvplot-xarray-plot/397, Why doesn't holoviews show histogram in Spyder?

What I get: ERR_CONNECTION_REFUSED but occasionally (don't know why) sample ocean data plot

0

There are 0 best solutions below