jupyter notebook inline plots as svg

set_matplotlib_formats() is deprecated since May 2021.

DeprecationWarning: set_matplotlib_formats is deprecated since IPython 7.23, directly use matplotlib_inline.backend_inline.set_matplotlib_formats() set_matplotlib_formats('svg')

Current Working method:

%matplotlib inline
import matplotlib_inline
matplotlib_inline.backend_inline.set_matplotlib_formats('svg')

%config InlineBackend.figure_formats = ['svg'] does the trick. A minimal example is:

%config InlineBackend.figure_formats = ['svg']

import matplotlib.pyplot as plt
%matplotlib inline
plt.plot()

Use set_matplotlib_formats('svg').

import matplotlib.pyplot as plt
from IPython.display import set_matplotlib_formats
%matplotlib inline
set_matplotlib_formats('svg')
plt.plot()

This is also documented in a document of %matplotlib magic.

Note: InlineBackend.figure_format is deprecated.