fangohr / introduction-to-python-for-computational-science-and-engineering

Book: Introduction to Python for Computational Science and Engineering

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warning on set_matplotlib_formats

kookma opened this issue · comments

On page 210 of book

%matplotlib inline
# settings for jupyter book: svg for html version, high-resolution png for pdf
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('svg', 'png')
import matplotlib as mpl
mpl.rcParams['figure.dpi'] = 400

returns warning! The below replacement remove the warning:

%matplotlib inline
# settings for jupyter book: svg for html version, high-resolution png for pdf
import matplotlib_inline.backend_inline
matplotlib_inline.backend_inline.set_matplotlib_formats('svg', 'png')
import matplotlib as mpl
mpl.rcParams['figure.dpi'] = 400

See scverse/scanpy#1842

Thank you @kookma !

I have trouble reproducing the warning you mention. Which versions of python, matplotlib and IPython do you use?

Hi Hans
I use Python 3.9.7 with Matplotlib 3.5.1 and IPython 7.31.1

I think this is resolved. Thanks for reporting it!