Bokeh Plot with Python View Node

There were 2 earlier post regarding that topic here:

and

But the more simpler way of plotting is the Python View Node:
And the code could be really easy with the usage of an html string:

import knime.scripting.io as knio

# This example uses an HTML string as the output view

from bokeh.plotting import figure
from bokeh.embed import file_html
from bokeh.resources import INLINE

#-----------------------------------------------
# do something with bokeh
plot = figure(width = 800, height = 450)
plot.circle([1,2], [3,4])
#-----------------------------------------------


html = file_html(plot,INLINE) # INLINE if needed to embed bokeh JS, otherwise its loaded from the net
knio.output_view = knio.view(html)

Could that be implemented as a template for the Python View Node?

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.