Tuesday, June 16, 2026
HomeLanguagesHow to add color-picker in Bokeh?

How to add color-picker in Bokeh?

In this article, we are going to see how to add a color picker widget in bokeh. 

Widgets are the best way to make charts more interactive. We can also add widgets in the Bokeh application to provide the best front-end user visualization. Using widgets we can do many things like update charts, connect to other programmatic functionality.  One of the widgets is the color picker.

Creating a color picker for the line chart in bokeh:

Python3




# displaying the chart
from bokeh.io import show
from bokeh.layouts import column
  
# importing colorpicker model from bokeh
from bokeh.models import ColorPicker
  
# plotting the figure
from bokeh.plotting import Figure
  
plot = Figure(x_range=(0, 1), 
              y_range=(0, 1), 
              plot_width=350
              plot_height=350)
  
line = plot.line(x=(0,1), 
                 y=(0,1),
                 color="black"
                 line_width=4)
  
picker = ColorPicker(title="Line Color")
  
picker.js_link('color'
               line.glyph,
               'line_color')
  
show(column(plot, picker))


Output:

Color Picker in Bokeh

We plot a line chart with a color picker. Here we have explicitly specifies the line chart color ‘black’. The color of the line is by default ‘blue’ of a line chart. We can choose any color from the color picker and change our line chart color. Here I have chosen green color.

Green color Line Chart – with color picker

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32516 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6897 POSTS0 COMMENTS
Nicole Veronica
12013 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6964 POSTS0 COMMENTS