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()))
autompg['colors'] = [cmap[o] for o in autompg.origin]
origin = [omap[o] for o in autompg.origin]

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

show(p)