Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python/matplotlib : getting rid of matplotlib.mpl warning

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 ?

like image 575
Vince Avatar asked Jul 01 '14 04:07

Vince


People also ask

What is Matplotlib use (' AGG ')?

The last, Agg, is a non-interactive backend that can only write to files. It is used on Linux, if Matplotlib cannot connect to either an X display or a Wayland display.

What does %Matplotlib mean in Python?

What Does Matplotlib Mean? Matplotlib is a plotting library available for the Python programming language as a component of NumPy, a big data numerical handling resource. Matplotlib uses an object oriented API to embed plots in Python applications.

What is the difference between Matplotlib Pyplot and Matplotlib?

The matplotlib. pyplot is a collection of functions that make matplotlib work like MATLAB. Each pyplot function makes some change to a figure: e.g., creates a figure, creates a plotting area in a figure, plots some lines in a plotting area, decorates the plot with labels, etc.


2 Answers

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

import warnings
import matplotlib.cbook
warnings.filterwarnings("ignore",category=matplotlib.cbook.mplDeprecation)
like image 100
CT Zhu Avatar answered Oct 12 '22 12:10

CT Zhu


you can temporarily suppress a warning, when importing

import warnings

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

with warnings.catch_warnings():
    warnings.simplefilter("ignore")
    fxn()
like image 35
johntellsall Avatar answered Oct 12 '22 10:10

johntellsall