As discussed with @bryevdv, we don't have a simple way to create a ColorBar when using linear_cmap() or log_cmap() (i.e. without explicitly importing and defining a ColorBar object).
The following code works, but it would be good to have an explicit method for this, similar to the construct method for the contour renderer.
r = plot.circle(x, y, color=linear_cmap('y', 'Turbo256', min(y), max(y)), size=10)
color_bar = ColorBar(color_mapper=r.glyph.fill_color.transform)
mapper_plot.add_layout(obj=color_bar, place="right")
Optimally, this should work like this:
r = plot.circle(...)
color_bar = r.construct_color_bar()
The construct_color_bar method would take some arguments, including an argument to define if the color_bar should use the mapper associated with a glyph's line or fill color (default to fill color). There also needs to be an error check to verify that the fill_color or line_color is a transform with a colormapper.
As discussed with @bryevdv, we don't have a simple way to create a ColorBar when using linear_cmap() or log_cmap() (i.e. without explicitly importing and defining a ColorBar object).
The following code works, but it would be good to have an explicit method for this, similar to the construct method for the contour renderer.
Optimally, this should work like this:
The
construct_color_barmethod would take some arguments, including an argument to define if the color_bar should use the mapper associated with a glyph's line or fill color (default to fill color). There also needs to be an error check to verify that the fill_color or line_color is a transform with a colormapper.