Open ahuang11 opened 1 year ago
Seems like entirely unrelated issues, the main one being that you're not using param correctly. The only parameter definition that will work here is a Selector
as you have to define the options of the ColorMap widget for it to work:
import param
import panel as pn
import colorcet as cc
pn.extension()
class Test(pn.viewable.Viewer):
palettes = param.Selector(objects={'glasbey': cc.b_glasbey_bw_minc_20})
def __panel__(self):
return pn.widgets.ColorMap.from_param(self.param.palettes)
Test()
The second "issue" you're observing is that the underlying Bokeh model uses the string name as the value of the widget so when you JS link it, it'll appear to be incorrect. This latter issues could maybe be worked around by defining a _source_transform
, but is unlikely to actually be useful.
Awesome!
https://panel.holoviz.org/reference/widgets/ColorMap.html
In the docs, the initial value is the colormap's palette, but upon selecting a new colormap from the dropdown, it becomes the name
I think it causes issues with: https://discourse.holoviz.org/t/how-to-use-from-param-with-colormap-widget/6304