I have a problem with the color label.
I want to remove the white color of the planets on my plot, but I keep getting errors. this is my script
`def plot_holoviews(mesh, data, wireframe=False, cmap=None, proj='pc', data_name='data',clabel=None, levels=None):
elem2 = mesh.elem[mesh.no_cyclic_elem]
data = np.ma.masked_equal(data, 0)
verts = pd.DataFrame({'Longitudes':mesh.x2, 'Latitudes':mesh.y2, 'data':data})
tris = pd.DataFrame({'v0':elem2[:,0],'v1':elem2[:,1], 'v2':elem2[:,2]})
fesom_mesh = gv.TriMesh((tris, verts), crs=crs.PlateCarree())
if wireframe:
verts2 = pd.DataFrame({'Longitudes':mesh.x2, 'Latitudes':mesh.y2})
trimesh = gv.TriMesh((tris, verts2), crs=crs.PlateCarree())
wireframe_plot = datashade(trimesh, interpolation=None, cmap=['black'])
if proj == 'pc':
projection=crs.PlateCarree()
width=800,
height=500,
y_range=(-80,90)
elif proj == 'np':
projection=crs.NorthPolarStereo()
width = 500,
height = 500,
y_range=(60,90)
elif proj == 'sp':
projection=crs.SouthPolarStereo()
width = 500,
height = 500,
y_range=(-90,-30)
if cmap is None:
cmap=cmo.balance
main_plot = rasterize(fesom_mesh, interpolation=None, y_range=y_range).opts(
tools=["hover"],
width=width[0],
height=height[0],
projection=projection,
colorbar=True,
cmap=cmap,
colorbar_position="bottom",
clabel=clabel,
fontscale=1.3,
color_levels=levels
)
if wireframe:
return main_plot * gv.feature.coastline() * wireframe_plot
else:
return main_plot * gv.feature.coastline()`
After Loading my data, I did this;
levels=[-5,-4,-3,-2,-1,0,1,2,3,4,5]
and the this;
plot_holoviews(mesh, data0, clabel="sea surface temperature", levels=levels)
I don't know what the problem is, can someone help me with this?
Thank you