Ok, looks like I can replicate The Matplotlib pyplot broken_barh pretty closely (bar the annotation) using Bokeh. Thanks!
# Reproducing the Matplotlib broken_barh example in Bokeh....
# (http://matplotlib.org/examples/pylab_examples/broken_barh.html)
import numpy as np
from bokeh.plotting import figure
from bokeh.io import output_notebook, show # I'm using Jupyter notebook
from bokeh.palettes import Accent3 as colors
from bokeh.models import Range1d, FixedTicker, HoverTool,Label
from bokeh.models.formatters import TickFormatter, String, List, Dict, Int
from bokeh import charts, plotting, models
import numpy
import pandas
import bokeh
output_notebook()
p = figure(height=600, width=800)#, y_range=['Bill', 'Jim'])
def bokeh_broken_barh(x, y, facecolors='blue'):
left = [i[0] for i in x]
right = [left[idx] + i[1] for idx,i in enumerate(x)]
p.quad(top=y[0] + y[-1], bottom=y[0], left=left, right=right,fill_color=facecolors)# ['red','blue'])#facecolors)
x_stlen = [(110, 30), (150, 10)]
y_stlen = (10, 9)
bokeh_broken_barh(x_stlen, y_stlen, facecolors='blue')
x_stlen = [(10, 50), (100, 20), (130, 10)]
y_stlen = (20, 9)
ret = bokeh_broken_barh(x_stlen, y_stlen,facecolors=['red', 'yellow', 'green'])
p.set(x_range=Range1d(0,200),y_range=Range1d(5,35))
p.xaxis.axis_label = 'seconds since start'
JS_CODE = """
_ = require "underscore"
Model = require "model"
p = require "core/properties"
class FixedTickFormatter extends Model
type: 'FixedTickFormatter'
doFormat: (ticks) ->
labels = @get("labels")
return (labels[tick] ? "" for tick in ticks)
@define {
labels: [ p.Any ]
}
module.exports =
Model: FixedTickFormatter
"""
class FixedTickFormatter(TickFormatter):
labels = Dict(Int, String, help="""
A mapping of integer ticks values to their labels.
""")
__implementation__ = JS_CODE
p.yaxis[0].formatter = FixedTickFormatter(labels={15 : "Bill", 25 : "Jim"})
show(p)