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?
Join Stack Overflow to learn, share knowledge, and build your career.
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?
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.
%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()
%matplotlib notebook
? I can't seem to find a way to make the figure display as svg quality
– mark jay
Jul 9 '17 at 21:08
InlineBackend.figure_format
is deprecated on IPython 2.0.0, use set_matplotlib_formats
instead.
– nekketsuuu
Dec 11 '18 at 7:03
InlineBackend.figure_format
is deprecated in favor of InlineBackend.figure_formats
(note the extra 's' at the end), which supports specifying multiple formats. Other than this, the usage through %config
is not deprecated.
– Zoltan
Mar 8 '19 at 13:37
set_matplotlib_formats()
can set the image formats and other options such as quality at the same time.
– nekketsuuu
Mar 11 '19 at 1:11