I have following code (part of it). I am trying to add a color bar for the palette used in the plot. I am successful in getting the plot but not he colorbar.
from bokeh.palettes import Turbo256
from bokeh.models import LinearAxis, Range1d,Label,
LabelSet,ColumnDataSource,LinearColorMapper,ColorBar
x = Combined_Data_Air[X1]
y = Combined_Data_Air[Y1a]
z = Combined_Data_Air['xxxxxxx']
# X1 and Y1a are Pandas column names.
source = ColumnDataSource(data = dict( x = x,y=y,z = z))
cmap = linear_cmap(field_name='z', palette="Turbo256",low = 0, high = 30)
s1.circle(x= 'x', y ='y', source=source,color=cmap, legend_label=Y1a,size=2)
color_bar = ColorBar(color_mapper=cmap,location = 'right')
in the last line of code I get following error.
ValueError: failed to validate ColorBar(id='1074', ...).color_mapper: expected an instance of type ColorMapper, got {'field': 'z', 'transform': LinearColorMapper(id='1054', ...)} of type dict
I can get the plot based on palette if I do not try to add the color bar.