In [4]:
import numpy as np
from bokeh.plotting import figure
from bokeh.io import output_notebook, show
from bokeh.models import Slider, WidgetBox, Row, ColumnDataSource
output_notebook()
In [14]:
fill_alpha = 0.5
init_color_value = 127
color = "rgb({0}, {0}, {0})".format(init_color_value)
source = ColumnDataSource(data=dict(fill_alpha=[fill_alpha], color=[color]))
plot = figure(plot_width=335, plot_height=100, title="RGBA Color Plot", toolbar_location=None, tools="", outline_line_color="#FFFFFF")
plot.rect(x=[1,], y=[1,], width=5, height=15, source=source, color="color", fill_alpha="fill_alpha")
r_slider = Slider(start=0, end=255, value=init_color_value, step=1, title="R")
In [16]:
show(plot)
show(r_slider)
Out[16]:
In [17]:
show(plot)
show(r_slider)
Out[17]:
In [18]:
show(plot)
show(r_slider)
Out[18]:
In [19]:
show(plot)
show(WidgetBox(r_slider))
Out[19]:
In [ ]: