Interactive SVG images#
User types
This section is useful for user type 3-5.
External software
SVG images can be made interactive by adding ‘slides’ to the SVG. This allows users to click through a set of images, showing dynamic processes. To make these kind of images, you can make use of Inkscape with JessyInk:
Fig. 115 Click through this interactive SVG image, available for download here#
Inkscape is a drawing program with which you can create SVG files.
JessyInk is an extension to Inkscape that lets you create svg slides that can be integrated in Jupyter notebooks and in Jupyter books.
This document briefly explains how. You are assumed to be familiar with Inkscape. It applies to Inkscape 1.2 or later.
For more help on Inkscape and JessyInk:
Create SVG slides for Jupyter notebooks and Jupyter books#
Start Inkscape
Activate the JessyInk extension. From the main menu select: “Extensions” –> “JessyInk” –> “install/update…” and click “Apply”.
Display the layers tab: From the main menu select: “Layer” –> “Layers And Objects…”
Create a master slide: the information on this slide will be displayed on all slides
On the layers tab right-click the layer name and select: “Rename Layer…”. This will bring up the “Rename Layer” dialog box. Enter the layer name e.g. “master slide” and click “Rename”.
From the main menu select: “Extensions” –> “JessyInk” –> “Master slide…”. This will bring up the “Maste slide” dialog box. Enter the name of your master slide and click “Apply”.
Put some stuff on this master slide. Later you can adjust it or move it to a better location. In this example, will put the following information on each slide:
The title of the presentation. Place a text object with the title of the presentation somewhere on this master slide
The name of the slide (using a placeholder)
Place a text placeholder like “#” somewhere on this master slide
Select this placeholder
From the main menu select: “Extensions” –> “JessyInk” –> “Auto-texts…”
This brings up the “Auto-texts” dialog box. Select “Slide title” and click “Apply”.
The slide number (using a placeholder)
Place a text placeholder like “##” somewhere on this master slide
Select this placeholder
From the main menu select: “Extensions” –> “JessyInk” –> “Auto-texts…”
This brings up the “Auto-texts” dialog box. Select “Slide number” and click “Apply”.
Create your slides. Each layer is a slide. The information on the master slide is added to each layer.
For each slide click “+” on the layers tab or copy and rename an existing slide.
Moving your mouse across a layer or an object displays a few icons. You can view/hide the layer/object by toggling the eye icon. You can enable/disable editing by toggling the key icon.
Create or modify the contents of the slide
Adjust the position of the master sheet objects such that they nicely line-up with your slides.. Adjust the width, height, and scale of the presentation.
From the main menu select: “Document properties”. DO NOT SELECT “Resize to content:”
Adjust “Width:”, “Height:” and “Scale:”.
Save the presentation
From the main menu select: “File” –> “Save As…”
Select a folder, enter a file name, and press “Save”.
Show the presentation. Open the presentation in a webbrowser. Use the mouse scroll wheel, “PgUp”, “PgDn”, “^”, “⌄”, “<”, or “>” to go through the slides. If necessary, fix the position of the presentation in the browser by pressing the “Shift” key while scrolling through it.
Include the slides in a Jupyter Book: Copy your presentation to the
_static
folder. This will make sure it’s available after the build. Reference to the file using relative links using Iframes. Use../
to go to the directory above or./
to open the current directory, i.e. the following syntax will give you the figure as shown above:
```{iframe-figure} ../_static/my_first_svg_presentation.svg
:name: svg_presentation
Click through this interactive SVG image!
```