In [1]:
from bokeh.models import HoverTool, ColumnDataSource
from bokeh.io import output_notebook, show
from bokeh.plotting import figure
from bokeh.sampledata.autompg import autompg

output_notebook()
Loading BokehJS ...
In [2]:
hover = HoverTool(
        tooltips=[
            ("Vehicle", "@name, [email protected]"),
            ("MPG", "@mpg"),
            ("Engine", "@displ cu in @cyl cylinder @hp HP"),
        ]
    )

cmap = dict(zip([1,2,3], 'red green blue'.split()))
omap = dict(zip([1,2,3], 'American European Asian'.split()))
origin = [omap[o] for o in autompg.origin]

autompg['colors'] = [cmap[o] for o in autompg.origin]
autompg['origin_tag'] = autompg.origin.map({1: 'American', 2: 'European', 3:'Asian'})

p = figure(tools=[hover], width=800, height=400)
p.circle('mpg', 'weight', color='colors', size=10, alpha=0.3, source=ColumnDataSource(autompg), legend='origin_tag')

show(p)
In [ ]: