from bokeh.models import Div from bokeh.plotting import figure, output_file, show output_file("div.html") # create a new Div object with some text text = "This is a new text." div = Div(text=text) # create a new plot with the Div object p = figure(title="Div Example") p.add_layout(div) # show the plot show(p)
from bokeh.models import Div from bokeh.plotting import figure, output_file, show output_file("div.html") # create a new Div object with an embedded YouTube video video_code = "my_video_code_here" html = "" % video_code div = Div(text=html) # create a new plot with the Div object p = figure(title="Div Example") p.add_layout(div) # show the plot show(p)In this example, the `Div` class is used to create a new HTML element that contains an embedded YouTube video. The `html` string variable contains the HTML code for the embedded video, and this code is passed as input to the `Div` object. The resulting `Div` object is then added to a new plot and displayed using the `show()` function.