Skip to content
KNIME Documentation
Main Navigation Get startedBuildWork with KnimeAccount and adminRelease notesDeveloper tools
Community Hub
DevelopersKnime
Sidebar Navigation

Getting Started

Installation

User Guide

Release Notes

Install Extensions

Building Workflows

Components

Flow Control

Expressions

File Handling

Deployment

Integrated Deployment

Workflow Invocation

Best Practices

Advanced Features

AI Extension

Get Started

Build an Agent

Inject context with RAG

LLM Providers

Tutorials

Summarize product reviews

Product FAQ assistant

Restaurant agent

Your first local agent

Task extractor

Reporting

Kerberos

Extensions

Database

Overview

Tutorials

Read and filter data from a database

Write a transformed dataset to a database

Concepts

Ports and Sessions

Query Generation

Type Mapping

Deprecated Framework

Connecting

Connect: Dedicated Node

Connect: File-Based Database

Connect: Generic DB Connector

Register a JDBC Driver

Install Third-Party Driver Plug-in

Drivers on Hub and Server

Kerberos Constrained Delegation

Reading and Transforming

Read Data

Transform Data Visually

Run a Custom SQL Query

Parameterize a Query

Writing and Modifying

Insert, Update, or Merge

Delete Rows

Bulk Load Data

Create and Remove Tables

Use Transactions

Reference

Connector Node Settings

JDBC Driver Reference

Deprecated Node Mapping

Migrate Deprecated Workflows

Python

Overview

Tutorials

Python Scripting Quickstart

Data App Development Using Plotly

Data Processing

K-AI Scripting Assistant

Data Type Conversion

Batch Processing

Jupyter Integration

Environment Management

Pixi Configuration

Dependency Management

Environment Persistence

Channel Mirrors & Air-Gapped Setups

Conda Migration

Alternative Configurations

Conda and Miniforge Setup

Conda Environment Propagation

Manual Python Configuration

Legacy Node Migration

Concepts

Pixi Backend Architecture

Storage Logic

Python Environments on Executors

Reference

Python Scripting API

Bundled Packages

Executor and Hub Configuration

Troubleshooting Guide

API Reference

Inputs and outputs

Classes

Views

Utility functions

R

Deep Learning

Snowflake

Google Cloud

Azure

AWS

Big Data

Big Data Admin

Big Data Secured Cluster

Databricks

Microsoft Fabric

Power BI

Tableau

Report Designer

H2O

Changelogs

Version 5.12

Version 5.11

Version 5.10

Version 5.9

Version 5.8

Version 5.7

Version 5.6

Version 5.5

Version 5.3

Extensions

Views ​

function knime.scripting.io.view(obj) → NodeView ​

Return a best-effort NodeView for obj.

The function attempts, in order, to

  1. match obj to one of the dedicated helper functions listed below, or
  2. fall back to the object's IPython _repr_*_ methods (_repr_html_, _repr_svg_, _repr_png_, _repr_jpeg_).

Images - SVG, PNG, JPEG, matplotlib, seaborn - are exported with a static snapshot and therefore show up in Reports of the KNIME Reporting Extension outputs automatically. All other supported objects (HTML strings, Plotly figures, etc.) are not supported in reports by default. To enable them in reports, use the view_html function and set the can_be_used_in_report flag.


Special view implementations

The input must match one of the following patterns:

  • HTML str starting with "<!DOCTYPE html>". Must be self-contained; external links open in a browser.
  • SVG str containing valid <svg … xmlns="…"> markup.
  • PNG bytes beginning with the PNG magic number.
  • JPEG bytes beginning 0xFFD8FF and ending 0xFFD9.
  • Matplotlib matplotlib.figure.Figure instance.
  • Plotly plotly.graph_objects.Figure instance.
Parameters ​
  • obj : Any — The object to visualise.
Raises ​
  • ValueError — If no suitable helper or _repr_*_ method is found.

function knime.scripting.io.view_matplotlib(fig = None, format = 'png') → NodeView ​

Create a NodeView that displays a matplotlib figure and is report-ready out of the box.

The figure is exported as a PNG or SVG (controlled by format). If fig is None, the current active figure is used. The figure is then closed so it should not be modified afterwards.

Because a static image is always supplied, the helper sets can_be_used_in_report=True automatically, allowing the view to appear in reports generated by the KNIME Reporting Extension without additional JavaScript.

Parameters ​
  • fig : matplotlib.figure.Figure — Figure to render. Defaults to the current figure.
  • format : (png, svg) — Output format embedded in the HTML snippet.
Raises ​
  • ImportError — If matplotlib is not available.
  • TypeError — If the figure is not a matplotlib figure.

function knime.scripting.io.view_seaborn() → NodeView ​

Create a NodeView that shows the current active seaborn figure and is report-ready out of the box.

The function simply forwards to view_matplotlib because seaborn charts are regular matplotlib figures under the hood.

As a static image is always embedded, the helper sets can_be_used_in_report=True automatically, so the view can be included in reports generated by the KNIME Reporting Extension without any extra JavaScript.

Raises ​
  • ImportError — If matplotlib is not available.

function knime.scripting.io.view_plotly(fig) → NodeView ​

Create a view showing the given plotly figure.

The figure is displayed by exporting it as an HTML document.

To be able to synchronize the selection between the view and other KNIME views the customdata of the figure traces must be set to the RowID.

Parameters ​
  • fig : plotly.graph_objects.Figure — A plotly figure object which should be displayed.
Raises ​
  • ImportError — If plotly is not available.
  • TypeError — If the figure is not a plotly figure.
Examples ​
python
>>> fig = px.scatter(df, x="my_x_col", y="my_y_col", color="my_label_col",
...                 custom_data=[df.index])
... node_view = view_plotly(fig)

function knime.scripting.io.view_html(html: str, svg_or_png: Optional[Union[str, bytes]] = None, render_fn: Optional[Callable[[], Union[str, bytes]]] = None, can_be_used_in_report = False) → NodeView ​

Create a NodeView that displays the given HTML document.

The document must be self-contained and must not reference external resources. Links to external resources will be opened in an external browser.

Parameters ​
  • html : str — A string containing the HTML document.
  • svg_or_png : str or bytes — A rendered representation of the HTML page. Either a string containing an SVG or a bytes object containing a PNG image.
  • render_fn : callable — A callable that returns an SVG or PNG representation of the page.
  • can_be_used_in_report : bool — Indicates whether this view will appear in a report generated by the KNIME Reporting Extension. Only set the flag to True when you provide the view to the knime-ui-extension-service ReportingService.

function knime.scripting.io.view_svg(svg: str) → NodeView ​

Create a NodeView that shows an SVG and is report-ready out of the box.

Parameters ​
  • svg : str — SVG markup (must include the <svg ...> root element with the XML namespace declaration).

function knime.scripting.io.view_png(png: bytes) → NodeView ​

Create a NodeView that shows a PNG image and is report-ready out of the box.

Parameters ​
  • png : bytes — Raw PNG data.

function knime.scripting.io.view_jpeg(jpeg: bytes) → NodeView ​

Create a NodeView that shows a JPEG image and is report-ready out of the box.

Parameters ​
  • jpeg : bytes — Raw JPEG data.

function knime.scripting.io.view_ipy_repr(obj) → NodeView ​

Create a NodeView by using the IPython _repr_*_ function of the object.

Tries to use:

  1. _repr_html_
  2. _repr_svg_
  3. _repr_png_
  4. _repr_jpeg_

in this order.

Parameters ​
  • obj : object — The object which should be displayed.
Raises ​
  • ValueError — If no view could be created for the given object.

class knime.scripting.io.NodeView ​

A wrapper that embeds a visualisation in KNIME Analytics Platform.

Notes

Do not instantiate NodeView directly—use one of the helper functions (view, view_html, view_svg, view_png, view_jpeg, …).

Parameters ​
  • html : str — Self-contained HTML snippet that renders the interactive view inside KNIME AP.
  • svg_or_png : str | bytes | None — Static SVG or PNG/JPEG bytes handed to the Reporting engine when a report is generated. If None, the value is produced lazily via render_fn.
  • render_fn : Callable[[], str | bytes] | None — Callback that returns svg_or_png on-demand.
  • can_be_used_in_report : bool — Set True to signal that this view can be embedded in a report produced by the KNIME Reporting Extension. _ Image helpers (view_svg, view_png, view_jpeg, view_matplotlib, …) turn the flag on automatically because they always provide the image to the Reporting engine. _ HTML helpers leave the flag False by default. Only enable it when the view's JavaScript sends a static representation to the ReportingService using reportingService.setReportingContent(...). If you are not in control of the JavaScript or cannot ensure this, keep the flag False so the view is omitted from the report instead of breaking it.
method __init__(html: str, svg_or_png: Optional[Union[str, bytes]] = None, render_fn: Optional[Callable[[], Union[str, bytes]]] = None, can_be_used_in_report: bool = False) → None ​
attribute can_be_used_in_report ​
attribute html ​
method render() → Union[str, bytes] ​
Pager
Previous pageClasses
Next pageUtility functions