I have a code (shown below as a minimal working example, MWE
) which produces a warning when plotting a colorbar:
/usr/local/lib/python2.7/dist-p
The printing of warning messages is done by calling showwarning(), which may be overridden; the default implementation of this function formats the message by calling formatwarning(), which is also available for use by custom implementations.
Override the showwarning()
method to do nothing when the warning is issued. The function has the message and category of the warning available to it when called, so you can check and only hide the warnings from matplotlib
.
Source: http://docs.python.org/2/library/warnings.html#warnings.showwarning