In [2]:
from bokeh.io import output_notebook, show
output_notebook()
In [15]:
import numpy as np
from bokeh.plotting import figure
N = 100
x = np.random.random(size=N) * 100
y = np.random.random(size=N) * 100
radii = np.random.random(size=N) * 2
multiplier = int((N/2))
# COLORS as in the original example
colors = [
"#%02x%02x%02x" % (r, g, 150) for r, g in zip(np.floor(50+2*x), np.floor(30+2*y))
]
# COLORS as strings with CSS colours
colors = ["orange", "pink"] * multiplier
# COLORS as RGB tuples
colors = [(10, 200, 10), (200, 10, 200)] * multiplier
# Use the same color all around!
# colors = colors[0]
p = figure(x_range=(0,100), y_range=(0,100))
p.circle(x,y, radius=radii, fill_color=colors)
show(p)
In [12]:
from itertools import product
from math import pi
cats = ['None', 'Alpha', 'RGB', 'RGBA', 'Alpha+RGB', 'Alpha+RGBA']
p = figure(x_range=cats, y_range=cats,
title="Fill and Line Color Property Combinations")
alpha = 0.5
fill_color = (242, 44, 64)
fill_color_alpha = (242, 44, 64, alpha)
line_color = (0, 0, 0)
line_color_alpha = (0, 0, 0, alpha)
# define fill and line color combinations
fill = [(1, {}),
(2, {'fill_alpha': alpha}),
(3, {'fill_color': fill_color})]
line = [(1, {}),
(2, {'line_alpha': alpha}),
(3, {'line_color': line_color})]
# plot intersection of fill and line combinations
combinations = product(fill, line)
for comb in combinations:
x, fill_options = comb[0]
y, line_options = comb[1]
options = fill_options.copy()
options.update(line_options)
p.circle(x, y, line_width=7, size=50, **options)
p.xaxis[0].axis_label = "Fill Options"
p.xaxis[0].major_label_orientation = pi/4
p.yaxis[0].axis_label = "Line Options"
show(p)
In [13]:
options
Out[13]:
In [ ]: