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

Choosing a plotting backend


There are different ways to display a plot in the Jupyter Notebook.

Inline plots

So far, we have created plots within the Notebook using the matplotlib inline mode. This is activated with the %matplotlib inline magic command in the Notebook. Figures created in this mode are converted to PNG images stored within the notebook .ipynb files. This is convenient when sharing notebooks because the plots are viewable by other users. However, these plots are static, and they are therefore not practical for interactive visualization.

Here is an example:

In [1]: import numpy as np
        import matplotlib.pyplot as plt
In [2]: %matplotlib inline
In [3]: plt.imshow(np.random.rand(10, 10), interpolation='none')

Inline backend

Exported figures

Matplotlib can export figures to bitmap (PNG, JPG, and others) or vector formats (PDF, EPS, and others). Refer to the documentation of plt.savefig() for more details: http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.savefig.

GUI...

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