Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Unable to change the color label #14

Open
StanleyAgu1 opened this issue Feb 12, 2021 · 1 comment
Open

Unable to change the color label #14

StanleyAgu1 opened this issue Feb 12, 2021 · 1 comment

Comments

@StanleyAgu1
Copy link

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

@koldunovn
Copy link
Member

@StanleyAgu1 This code is not related to pyfesom, it's probably more of the geoviews issue.

It's also not clear from your post what modules you are using and what errors you are having. Notebook or script with minimum example would be helpful.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants