{% include JB/setup %}
By default, Apache Zeppelin prints interpreter response as a plain text using text
display system.
You can explicitly say you're using text
display system.
With %html
directive, Zeppelin treats your output as HTML
HTML display system automatically formats mathematical expression using MathJax. You can use \\( INLINE EXPRESSION \\)
and $$ EXPRESSION $$
to format. For example
If you have data that row separated by \n
(newline) and column separated by \t
(tab) with first row as header row, for example
You can simply use %table
display system to leverage Zeppelin's built in visualization.
If table contents start with %html
, it is interpreted as an HTML.
Note : Display system is backend independent.
With the %network
directive, Zeppelin treats your output as a graph. Zeppelin can leverage the Property Graph Model.
A Property Graph is a graph that has these elements:
A Labelled Property Graph is a Property Graph where the nodes can be tagged with labels representing their different roles in the graph model
The new NETWORK visualization is based on json with the following params:
If you click on a node or edge on the bottom of the paragraph you find a list of entity properties
This kind of graph can be easily flatten in order to support other visualization formats provided by Zeppelin.
An example of a simple graph
%spark print(s""" %network { "nodes": [ {"id": 1}, {"id": 2}, {"id": 3} ], "edges": [ {"source": 1, "target": 2, "id" : 1}, {"source": 2, "target": 3, "id" : 2}, {"source": 1, "target": 2, "id" : 3}, {"source": 1, "target": 2, "id" : 4}, {"source": 2, "target": 1, "id" : 5}, {"source": 2, "target": 1, "id" : 6} ] } """)
that will look like:
A little more complex graph:
%spark print(s""" %network { "nodes": [{"id": 1, "label": "User", "data": {"fullName":"Andrea Santurbano"}},{"id": 2, "label": "User", "data": {"fullName":"Lee Moon Soo"}},{"id": 3, "label": "Project", "data": {"name":"Zeppelin"}}], "edges": [{"source": 2, "target": 1, "id" : 1, "label": "HELPS"},{"source": 2, "target": 3, "id" : 2, "label": "CREATE"},{"source": 1, "target": 3, "id" : 3, "label": "CONTRIBUTE_TO", "data": {"oldPR": "https://github.com/apache/zeppelin/pull/1582"}}], "labels": {"User": "#8BC34A", "Project": "#3071A9"}, "directed": true, "types": ["HELPS", "CREATE", "CONTRIBUTE_TO"] } """)
that will look like: