16

I am using matplotlib using python 3.4. When I start my program, I have the following warning message:

C:\Python34-32bits\lib\site-packages\matplotlib\cbook.py:123: MatplotlibDeprecationWarning: The matplotlib.mpl module was deprecated in version 1.3. Use import matplotlib as mpl instead. warnings.warn(message, mplDeprecation, stacklevel=1)

As far as I know I do not use mpl, and all my imports concerning matplotlib are:

import matplotlib.pyplot as plt
import matplotlib.animation as animation

Anything I should do ?

Innat
  • 16,113
  • 6
  • 53
  • 101
Vince
  • 3,979
  • 10
  • 41
  • 69

5 Answers5

41

You can suppress that particular warning, which is probably the preferred way:

import warnings
import matplotlib.cbook
warnings.filterwarnings("ignore",category=matplotlib.cbook.mplDeprecation)
CT Zhu
  • 52,648
  • 17
  • 120
  • 133
3

you can temporarily suppress a warning, when importing

import warnings

def fxn():
    warnings.warn("deprecated", DeprecationWarning)

with warnings.catch_warnings():
    warnings.simplefilter("ignore")
    fxn()
johntellsall
  • 14,394
  • 4
  • 46
  • 40
2

I was able to suppress that warning with the code below:

import warnings

warnings.filterwarnings("ignore",category=UserWarning)
MT_Shikomba
  • 129
  • 1
  • 6
0

It would be useful to see the code, however remember to set the parameters of the plot first, only then initialize the plot.

Exemple, what you may have done:

plt.pcolormesh(X, Y, Z)
plt.axes().set_aspect('equal')

What you have to do:

plt.axes().set_aspect('equal')
plt.pcolormesh(X, Y, Z)
Omar Cusma Fait
  • 313
  • 1
  • 11
0

Due to

MatplotlibDeprecationWarning: mplDeprecation was deprecated in Matplotlib 3.6 and will be removed two minor releases later ...

use this instead:

import warnings
import matplotlib
warnings.filterwarnings("ignore", category=matplotlib.MatplotlibDeprecationWarning)
simons____
  • 101
  • 1
  • 2