Purpose of "%matplotlib inline"

The purpose of "%matplotlib inline" in Python is to display matplotlib plots within the Jupyter notebook.

A code snippet would look like this:

%matplotlib inline
import matplotlib.pyplot as plt

x = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]

plt.plot(x, y)
plt.show()

Watch a course Python - The Practical Guide

This code first imports the matplotlib library, creates a simple plot, and then displays it in the notebook.

Alternatively, you can use %matplotlib notebook for interactive plots.