svgmatplotlibjupyter-notebook

jupyter notebook inline plots as svg


By default jupyter notebook inline plots are displayed as png, e.g.:

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

How can you configure jupyter notebooks to display matplotlib inline plots as svg?


Solution

  • 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')