Reader small image

You're reading from  Learning IPython for Interactive Computing and Data Visualization, Second Edition

Product typeBook
Published inOct 2015
Reading LevelBeginner
Publisher
ISBN-139781783986989
Edition1st Edition
Languages
Right arrow
Author (1)
Cyrille Rossant
Cyrille Rossant
author image
Cyrille Rossant

Cyrille Rossant, PhD, is a neuroscience researcher and software engineer at University College London. He is a graduate of École Normale Supérieure, Paris, where he studied mathematics and computer science. He has also worked at Princeton University and Collège de France. While working on data science and software engineering projects, he gained experience in numerical computing, parallel computing, and high-performance data visualization. He is the author of Learning IPython for Interactive Computing and Data Visualization, Second Edition, Packt Publishing.
Read more about Cyrille Rossant

Right arrow

Displaying rich HTML elements in the Notebook


The Jupyter Notebook application is based on HTML and runs in a web browser. This platform supports many kinds of rich content such as images, mathematical equations, interactive widgets, videos, and much more. Jupyter proposes several methods to leverage these capabilities.

In this section, we'll show how to display HTML, SVG, and JavaScript elements, notably with the Data-Driven Documents (D3) JavaScript visualization library.

Displaying SVG in the Notebook

Scalable Vector Graphics (SVG) is an open XML-based file format describing vector graphics. Most modern web browsers support this format.

For displaying objects, IPython provides a simple API for representing rich content like SVG. In the following example, we'll define a Disc class with a customizable radius and a color. When displaying a Disc instance in the Notebook, an SVG representation of the disc will be shown.

Let's first define a function generating the SVG code for a disc:

In [1]...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Learning IPython for Interactive Computing and Data Visualization, Second Edition
Published in: Oct 2015Publisher: ISBN-13: 9781783986989

Author (1)

author image
Cyrille Rossant

Cyrille Rossant, PhD, is a neuroscience researcher and software engineer at University College London. He is a graduate of École Normale Supérieure, Paris, where he studied mathematics and computer science. He has also worked at Princeton University and Collège de France. While working on data science and software engineering projects, he gained experience in numerical computing, parallel computing, and high-performance data visualization. He is the author of Learning IPython for Interactive Computing and Data Visualization, Second Edition, Packt Publishing.
Read more about Cyrille Rossant