categorical

< quiver | back to Gallery | periodic >

from bokeh.plotting import figure, show, output_file, vplot

factors = ["a", "b", "c", "d", "e", "f", "g", "h"]
x =  [50, 40, 65, 10, 25, 37, 80, 60]

p1 = figure(title="Dot Plot", tools="resize,save", y_range=factors, x_range=[0,100])

p1.segment(0, factors, x, factors, line_width=2, line_color="green", )
p1.circle(x, factors, size=15, fill_color="orange", line_color="green", line_width=3, )

factors = ["foo", "bar", "baz"]
x = ["foo", "foo", "foo", "bar", "bar", "bar", "baz", "baz", "baz"]
y = ["foo", "bar", "baz", "foo", "bar", "baz", "foo", "bar", "baz"]
colors = [
    "#0B486B", "#79BD9A", "#CFF09E",
    "#79BD9A", "#0B486B", "#79BD9A",
    "#CFF09E", "#79BD9A", "#0B486B"
]

p2 = figure(title="Categorical Heatmap", tools="resize,hover,save",
    x_range=factors, y_range=factors)

p2.rect(x, y, color=colors, width=1, height=1)

output_file("categorical.html", title="categorical.py example")

show(vplot(p1, p2))  # open a browser