Based on this
from bokeh.charts import output_notebook, show
from bokeh import charts
from bokeh.resources import CDN
import yaml
from yaml import SafeLoader, Loader, BaseLoader
output_notebook(resources=CDN)
%reload_ext yamlmagic
class BokehLoader(SafeLoader):
pass
def line_constructor(loader, node):
bits = loader.construct_mapping(node, deep=True)
return charts.Line(**bits)
BokehLoader.add_constructor("!line", line_constructor)
%%yaml plot -lBokehLoader
!line
values:
y: [6, 7, 2, 4, 5]
z: [1, 5, 12, 4, 2]
title: simple line example
xlabel: x
ylabel: values
width: 400
height: 400
show(plot)